!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("photoeditorsdk/js/PhotoEditorSDK"),require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["photoeditorsdk","react","react-dom"],t):"object"==typeof exports?exports.PhotoEditorReactUI=t(require("photoeditorsdk/js/PhotoEditorSDK"),require("react"),require("react-dom")):e.PhotoEditorReactUI=t(e.PhotoEditorSDK,e.React,e.ReactDOM)}("undefined"!=typeof self?self:this,function(e,t,n){return function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=66)}([function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.SharedConstants=t.PropTypes=t.ImageLoader=t.ImageFormat=t.ColorMatrix=t.now=t.Log=t.cancelAnimationFrame=t.requestAnimationFrame=t.SDK=t.EXIF=t.ReactDOM=t.UniformType=t.OptionType=t.RenderType=t.Base64=t.Color=t.SharedState=t.Constants=t.EventEmitter=t.SDKUtils=t.Range=t.Vector2=t.ReactBEM=t.BaseComponent=t.Classnames=t.BEM=t.React=t.Utils=t.Promise=void 0;var r=i(n(5)),o=i(n(18)),a=i(n(69)),s=i(n(33)),l=i(n(34)),c=i(n(35)),u=i(n(36)),f=i(n(72)),p=i(n(73)),d=i(n(89)),h=i(n(91)),_=n(92),m=i(n(19)),y=i(n(23)),g=i(n(22)),v=r.default.Base64,b=r.default.Color,k=r.default.Math.ColorMatrix,w=r.default.EventEmitter,O=r.default.EXIF,E=r.default.OptionType,S=r.default.Promise,P=r.default.Utils,C=r.default.RenderType,x=r.default.ImageFormat,j=r.default,M=r.default.UniformType,R=r.default.Math.Vector2,T=r.default.Math.Range,B="undefined"!=typeof window&&window.performance&&window.performance.now?window.performance.now.bind(window.performance):n(37);t.Promise=S,t.Utils=p.default,t.React=o.default,t.BEM=c.default,t.Classnames=l.default,t.BaseComponent=f.default,t.ReactBEM=u.default,t.Vector2=R,t.Range=T,t.SDKUtils=P,t.EventEmitter=w,t.Constants=d.default,t.SharedState=h.default,t.Color=b,t.Base64=v,t.RenderType=C,t.OptionType=E,t.UniformType=M,t.ReactDOM=a.default,t.EXIF=O,t.SDK=j,t.requestAnimationFrame=_.requestAnimationFrame,t.cancelAnimationFrame=_.cancelAnimationFrame,t.Log=m.default,t.now=B,t.ColorMatrix=k,t.ImageFormat=x,t.ImageLoader=y.default,t.PropTypes=s.default,t.SharedConstants=g.default},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=n(0),l=function(e){function t(e,n,o){var a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];i(this,t);var s=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return s.type=e,s.title=n,s.text=o,s.overlay=a,s.data=null,s}return o(t,s.EventEmitter),a(t,[{key:"setData",value:function(e){this.data=e,this.emit("update")}},{key:"close",value:function(){this.emit("close")}}]),t}(),c=function(e){function t(){i(this,t);var e=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e._modals=[],e}return o(t,s.EventEmitter),a(t,[{key:"displayLoading",value:function(e){var t=new l("loading",null,e);return this.addModal(t),t}},{key:"displayProgress",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=new l("progress",null,e);return n.setData({progress:t}),this.addModal(n),n}},{key:"displayWarning",value:function(e,t){var n=new l("warning",e,t);return this.addModal(n),n}},{key:"displayError",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=new l("error",e,t,n);return this.addModal(i),i}},{key:"addModal",value:function(e){var t=this;this._modals.push(e),e.on("close",function(){t.removeModal(e)}),e.on("update",function(){t.emit("update")}),this.emit("update")}},{key:"removeModal",value:function(e){var t=this._modals.indexOf(e);this._modals.splice(t,1),this.emit("update")}},{key:"getModals",value:function(){return this._modals}}],[{key:"instance",get:function(){return this._instance||(this._instance=new t),this._instance}}]),t}();t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(6)),a=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.constructor.NATIVE_SCROLLBAR_WIDTH||(e.constructor.NATIVE_SCROLLBAR_WIDTH=r.Utils.getScrollbarWidth()),e._needsStyleFixes=!0,e._isDragging=!1,e._bindAll("_onButtonDragStart","_onButtonDrag","_onButtonDragStop","_onBarDragStart","_onBarDrag","_onBarDragStop","_onListScroll"),e.state={buttonSize:0,buttonPosition:0,buttonVisible:!1},e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"componentDidMount",value:function(){(function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this),this.update()}},{key:"fixStyles",value:function(){r.Utils.isMobile()||this._updateListSize()}},{key:"_onListScroll",value:function(){if(!this._isDragging){var e=this._getDirection(),n=void 0,i=void 0,r=void 0;e===t.HORIZONTAL?(n=this._list.scrollWidth-this._list.offsetWidth,i=this._list.scrollLeft,r=this._node.offsetWidth-this.state.buttonSize):e===t.VERTICAL&&(n=this._list.scrollHeight-this._list.offsetHeight,i=this._list.scrollTop,r=this._node.offsetHeight-this.state.buttonSize);var o=i/n;this.setState({buttonPosition:r*o})}}},{key:"_onButtonDragStart",value:function(e){this._isDragging=!0,this._initialButtonPosition=this.state.buttonPosition||0}},{key:"_onButtonDrag",value:function(e){var n=this._getDirection(),i=void 0;n===t.HORIZONTAL?i=this._initialButtonPosition+e.x:n===t.VERTICAL&&(i=this._initialButtonPosition+e.y),this._setButtonPosition(i)}},{key:"_onButtonDragStop",value:function(){this._isDragging=!1}},{key:"_onBarDragStart",value:function(e){var n=r.Utils.getEventPosition(e);this._initialPosition=n.clone();var i=this._node.getBoundingClientRect(),o=new r.Vector2(i.left,i.top),a=n.clone().subtract(o),s=this._getDirection();s===t.HORIZONTAL?this._setButtonPosition(a.x-this.state.buttonSize/2):s===t.VERTICAL&&this._setButtonPosition(a.y-this.state.buttonSize/2),document.addEventListener("mousemove",this._onBarDrag),document.addEventListener("touchmove",this._onBarDrag),document.addEventListener("mouseup",this._onBarDragStop),document.addEventListener("touchend",this._onBarDragStop)}},{key:"_onBarDrag",value:function(e){var n=r.Utils.getEventPosition(e),i=this._node.getBoundingClientRect(),o=new r.Vector2(i.left,i.top),a=n.clone().subtract(o),s=this._getDirection();s===t.HORIZONTAL?this._setButtonPosition(a.x-this.state.buttonSize/2):s===t.VERTICAL&&this._setButtonPosition(a.y-this.state.buttonSize/2)}},{key:"_onBarDragStop",value:function(){document.removeEventListener("mousemove",this._onBarDrag),document.removeEventListener("touchmove",this._onBarDrag),document.removeEventListener("mouseup",this._onBarDragStop),document.removeEventListener("touchend",this._onBarDragStop)}},{key:"_setButtonPosition",value:function(e){var n=this._getDirection(),i=void 0,r=void 0;n===t.HORIZONTAL?(i=this._node.offsetWidth-this.state.buttonSize,r=this._list.scrollWidth-this._list.offsetWidth):n===t.VERTICAL&&(i=this._node.offsetHeight-this.state.buttonSize,r=this._list.scrollHeight-this._list.offsetHeight),e=Math.max(0,e),e=Math.min(e,i),this.setState({buttonPosition:e});var o=r*(e/i);n===t.HORIZONTAL?this._list.scrollLeft=o:n===t.VERTICAL&&(this._list.scrollTop=o)}},{key:"_updateButtonSize",value:function(e){var n,i,r=void 0,o=void 0,a=this._getDirection();a===t.HORIZONTAL?(r=this._list.clientWidth,o=this._list.scrollWidth):a===t.VERTICAL&&(r=this._list.offsetHeight,o=this._list.scrollHeight),n=r/o*r,i=o>r,this.setState({buttonSize:n,buttonVisible:i},e)}},{key:"_updateListSize",value:function(){if(this._list){var e=this._getDirection();if(e===t.HORIZONTAL){this._list.style.height="";var n=this._getFullListDimensions();this._listSize=n.y,this._listContentSize=this._list.offsetHeight}else if(e===t.VERTICAL){this._list.style.width="";var i=this._getFullListDimensions();this._listSize=i.x,this._listContentSize=this._list.offsetWidth}}}},{key:"_getFullListDimensions",value:function(){var e=this._list.getBoundingClientRect();return new r.Vector2(e.width,e.height)}},{key:"update",value:function(){var e=this;if(!r.Utils.isMobile()){var n=this.refs,i=n.root,o=n.list;this._node=i,this._list=o;var a=this._getDirection();this._updateButtonSize(function(){e._listSize||e._updateListSize();var n=e._listSize;e.state.buttonVisible&&(n+=e.constructor.NATIVE_SCROLLBAR_WIDTH),a===t.HORIZONTAL?(e._list.style.height=n+"px",e._node.style.top=e._listContentSize-12+"px",e._node.style.width=e._list.offsetWidth+"px"):a===t.VERTICAL&&(e._list.style.width=n+"px",e._node.style.left=e._listContentSize-12+"px",e._node.style.height=e._list.offsetHeight+"px")}),this._list.addEventListener("scroll",this._onListScroll)}}},{key:"_getDirection",value:function(){return this.props.direction||"horizontal"}},{key:"_getButtonStyle",value:function(){return"horizontal"===this._getDirection()?{left:this.state.buttonPosition,width:this.state.buttonSize}:{top:this.state.buttonPosition,height:this.state.buttonSize}}},{key:"getList",value:function(){return this.refs.list}},{key:"getRoot",value:function(){return this.refs.root}},{key:"renderWithBEM",value:function(){if(r.Utils.isMobile())return this.props.children;var e=this._getButtonStyle(),t={display:this.state.buttonVisible?"block":"none"},n=r.React.cloneElement(this.props.children,{ref:"list"});return r.ReactBEM.createElement("div",null,n,r.ReactBEM.createElement("div",{bem:"$b:scrollbar m:"+(this.props.direction||"horizontal")+" m:"+(this.state.buttonVisible?"visible":"invisible"),ref:"root",style:t,onMouseDown:this._onBarDragStart,onTouchStart:this._onBarDragStart},r.ReactBEM.createElement(o.default,{onStart:this._onButtonDragStart,onDrag:this._onButtonDrag,onStop:this._onButtonDragStop},r.ReactBEM.createElement("div",{bem:"e:bar",style:e,onMouseDown:this._onButtonDown}))))}}]),t}();t.default=a,a.HORIZONTAL="horizontal",a.VERTICAL="vertical",a.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(117)),s=i(n(118)),l=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._hasBackButton=!0,o._hasDoneButton=!1,o._backButtonClicked=!1,o._bindAll("_onBackClick","_onDoneClick"),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.BaseComponent),r(t,[{key:"getGlobalToolState",value:function(e){return this.context.globalState.get(e)}},{key:"setGlobalToolState",value:function(e,t){this.context.globalState.set(function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},e,t))}},{key:"_onBackClick",value:function(e){this._backButtonClicked=!0,this.props.onSwitchControls("back"),e.preventDefault()}},{key:"_onDoneClick",value:function(e){this._onBackClick()}},{key:"renderControls",value:function(){return null}},{key:"renderOverlayControls",value:function(){return null}},{key:"renderWithBEM",value:function(){var e=this.props.options&&this.props.options.forcedControl,t=this._hasBackButton&&!e?o.ReactBEM.createElement(a.default,{onClick:this._onBackClick}):null,n=this._hasDoneButton||e?o.ReactBEM.createElement(s.default,{onClick:this._onDoneClick}):null;return o.ReactBEM.createElement("div",{bem:"$b:controls",ref:"root"},this.renderOverlayControls(),o.ReactBEM.createElement("div",{bem:"e:table"},t,this.renderControls(),n))}}]),t}();t.default=l,l.contextTypes=o.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return i(e,[{key:"getInitialSharedState",value:function(){return{}}},{key:"getGlobalToolState",value:function(){return this.context.globalState.get(this.constructor.identifier)}},{key:"setGlobalToolState",value:function(e){this.context.globalState.set(function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},this.constructor.identifier,e))}},{key:"isAvailable",value:function(e){return!1}}],[{key:"getPreloadAssets",value:function(){return[]}}]),e}();r.topBarControlsComponent=null,r.controlsComponent=null,r.canvasControlsComponent=null,r.identifier=null,r.iconPath=null,r.languageKey=null,r.defaultOptions={},t.default=r},function(t,n){t.exports=e},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._bindAll("_onDragStart","_onDragMove","_onDragEnd"),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"_onDragStart",value:function(e){if(!this.props.disabled){e.preventDefault(),e.stopPropagation(),this._initialMousePosition=r.Utils.getEventPosition(e),document.addEventListener("mousemove",this._onDragMove),document.addEventListener("touchmove",this._onDragMove),document.addEventListener("mouseup",this._onDragEnd),document.addEventListener("touchend",this._onDragEnd);var t=this.refs.element.getBoundingClientRect(),n=new r.Vector2(t.left,t.top),i=this._initialMousePosition.clone().subtract(n);this.props.onStart&&this.props.onStart(i,e)}}},{key:"_onDragMove",value:function(e){e.preventDefault(),e.stopPropagation();var t=r.Utils.getEventPosition(e);if(t){var n=t.clone().subtract(this._initialMousePosition);this.props.onDrag&&this.props.onDrag(n,e)}}},{key:"_onDragEnd",value:function(e){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this._onDragMove(e),document.removeEventListener("mousemove",this._onDragMove),document.removeEventListener("touchmove",this._onDragMove),document.removeEventListener("mouseup",this._onDragEnd),document.removeEventListener("touchend",this._onDragEnd),this.props.onStop&&this.props.onStop(e)}},{key:"render",value:function(){if(!this.props.children||this.props.children instanceof Array)throw new Error("DraggableComponent expects exactly one child.");return r.React.cloneElement(this.props.children,{onMouseDown:this._onDragStart,onTouchStart:this._onDragStart,ref:"element"})}}]),t}();t.default=o,o.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(15)),a=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._bindAll("_onSliderValueChange"),o.state={value:o.props.value},o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"componentWillReceiveProps",value:function(e){e.value!==this.state.value&&(this.state.value=e.value)}},{key:"_onSliderValueChange",value:function(e){this.props.onChange&&this.props.onChange(e),this.setState({value:e})}},{key:"_renderSlider",value:function(){var e=r.SDKUtils.defaults(this.props,{style:"",middleDot:!1,minValue:1,maxValue:100,label:"Label",onChange:this._onSliderValueChange,value:this.state.value});return r.ReactBEM.createElement(o.default,e)}},{key:"renderWithBEM",value:function(){return r.ReactBEM.createElement("div",{bem:"$b:controls e:overlay m:slider m:dark"},this._renderSlider())}}]),t}();t.default=a,a.contextTypes=r.BaseComponent.contextTypes},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(0),s=i(n(164)),l=i(n(19)),c=i(n(46)),u=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._ui=t,this._options=n,this._fonts=[],this._variationsByIdentifier={},this._fontsByFontFamily={},this._initFonts()}return o(e,[{key:"_initFonts",value:function(){var e=this,t=this._options,n=t.fonts,i=t.replaceFonts,r=t.availableVariations,o=a.Constants.DEFAULTS.FONTS,u=void 0;o=(o=i?n:o.concat(n||[])).map(function(t){var n=t.fontFamily,i=t.variations;if(r&&(i=i.filter(function(e){return-1!==r.indexOf(e.identifier)})),0===i.length)return null;var o=new s.default({fontFamily:n});return i=i.map(function(t){var i=new c.default(t);return i.setFontFamily(n),i.setFont(o),t.default&&!u&&(u=i),null==i.getTextMetrics()&&l.default.warn("Missing font metrics for "+i.getIdentifier()+". The SDK will fall back to basic font rendering, which may lead to layout issues. Please provide font metrics for your custom fonts. See https://docs.photoeditorsdk.com/guides/html5/ for more details."),e._variationsByIdentifier[i.getIdentifier()]=i,i}),o.setVariations(i),e._fontsByFontFamily[n]=o,o}).filter(function(e){return e}),u||(u=o[0].getVariations()[0]),this._defaultVariation=u,this._fonts=o}},{key:"getFonts",value:function(){return this._fonts}},{key:"getFontByFontFamily",value:function(e){return this._fontsByFontFamily[e]}},{key:"getVariationByIdentifier",value:function(e){return this._variationsByIdentifier[e]}},{key:"getVariationsByIdentifier",value:function(){return r({},this._variationsByIdentifier)}},{key:"getDefaultVariation",value:function(){return this._defaultVariation}}]),e}();t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(95)),a=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"_renderHeader",value:function(){return this.context.options.showHeader?r.ReactBEM.createElement(o.default,null):null}},{key:"_renderScreen",value:function(){return r.ReactBEM.createElement("div",null)}},{key:"renderWithBEM",value:function(){var e="b:screen";return this.context.options.showHeader||(e+=" m:noHeader"),r.ReactBEM.createElement("div",{bem:e,className:this.props.visible?null:"is-hidden"},this._renderHeader(),this._renderScreen())}}]),t}();t.default=a,a.propTypes={editor:r.PropTypes.any},a.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0},o=n(0),a=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._bindAll("_onCanvasZoomDone"),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.BaseComponent),i(t,[{key:"_performHitTest",value:function(e){var t=this.refs.container.getBoundingClientRect(),n=new o.Vector2(t.left,t.top),i=e.subtract(n),r=this.context.editor,a=r.controls.getAvailable();for(var s in a){var l=a[s],c=l.clickAtPosition&&l.clickAtPosition(i,r);if(c)return c.selectedSprite===this.getSharedState("selectedSprite")||(this.props.onSwitchControls(l,c),!0)}return!1}},{key:"_onCanvasZoomDone",value:function(){this.forceUpdate()}},{key:"_bindEvents",value:function(){r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_bindEvents",this).call(this),this.context.mediator.on(o.Constants.EVENTS.ZOOM_DONE,this._onCanvasZoomDone)}},{key:"_unbindEvents",value:function(){r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_unbindEvents",this).call(this),this.context.mediator.off(o.Constants.EVENTS.ZOOM_DONE,this._onCanvasZoomDone)}}]),t}();t.default=a,a.contextTypes=o.BaseComponent.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(5),a=n(0),s=i(n(22)),l=i(n(21)),c=i(n(44)),u=function(){function e(t,n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._ui=t,this._options=n,this._dynamicAssetsLibrary=i||this._ui.getEditor().getDynamicAssetsLibrary()||new c.default,this._categoriesById={},this._categories=[],this._stickersById={},this._customStickerCanvas=o.Utils.createCanvas(),this.reload()}return r(e,[{key:"reload",value:function(){this._categoriesById={},this._categories=[],this._stickersById={},this._addCategories(s.default.DEFAULTS.STICKER_CATEGORIES);var e=this._options,t=e.categories,n=e.replaceCategories;this._options.categories?this._addCategories(t,n):(this._updateCategoriesMap(),this._updateAllCategory());var i=this._dynamicAssetsLibrary.getAssets("sticker");if(i.length>0){var r=this._createCustomStickerCategory(i);this._addCategories([r],!1,!0)}}},{key:"loadExternal",value:function(e){var t=this;return new l.default(e).load().then(function(e){t._addCategories(e.categories,t._options.replaceCategories)})}},{key:"_addCategories",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this._categories=t?e.slice(0):n?this._mergeCategories(e,this._categories):this._mergeCategories(this._categories,e),this._updateCategoriesMap(),this._updateAllCategory()}},{key:"_mergeCategories",value:function(e,t){e=a.Utils.cloneCategories(e,"stickers");var n=!0,i=!1,r=void 0;try{for(var o,s=t[Symbol.iterator]();!(n=(o=s.next()).done);n=!0){var l=o.value,c=!1,u=!0,f=!1,p=void 0;try{for(var d,h=e[Symbol.iterator]();!(u=(d=h.next()).done);u=!0){var _=d.value;if(l.identifier===_.identifier){var m=!0,y=!1,g=void 0;try{for(var v,b=l.stickers[Symbol.iterator]();!(m=(v=b.next()).done);m=!0){var k=v.value,w=!1,O=!0,E=!1,S=void 0;try{for(var P,C=_.stickers[Symbol.iterator]();!(O=(P=C.next()).done);O=!0){var x=P.value;if(k.identifier===x.identifier){Object.assign(x,k),w=!0;break}}}catch(e){E=!0,S=e}finally{try{!O&&C.return&&C.return()}finally{if(E)throw S}}w||_.stickers.push(k)}}catch(e){y=!0,g=e}finally{try{!m&&b.return&&b.return()}finally{if(y)throw g}}c=!0;break}}}catch(e){f=!0,p=e}finally{try{!u&&h.return&&h.return()}finally{if(f)throw p}}c||e.push(l)}}catch(e){i=!0,r=e}finally{try{!n&&s.return&&s.return()}finally{if(i)throw r}}return e}},{key:"_updateCategoriesMap",value:function(){var e=this;this._categoriesById={},this._categories.forEach(function(t){e._categoriesById[t.identifier]=t}),this._categories.forEach(function(t){t.stickers.forEach(function(t){e._stickersById[t.identifier]=t})}),void 0!==this._options.availableStickers&&null!==this._options.availableStickers&&(this._categories.forEach(function(t){"imgly_sticker_custom"!==t.identifier&&(t.stickers=t.stickers.filter(function(t){return-1!==e._options.availableStickers.indexOf(t.identifier)}))}),this._categories=this._categories.filter(function(e){return e.stickers.length>0})),this._updateAllCategory()}},{key:"_updateAllCategory",value:function(){this._allCategory={identifier:"all",defaultName:"All",stickers:this._categories.map(function(e){return e.stickers}).reduce(function(e,t){return e.concat(t)},[])},this._categoriesById.all=this._allCategory}},{key:"renderStickerThumbnailFromImage",value:function(e){var t=this._customStickerCanvas,n=t.getContext("2d");n.save();var i=62/e.width,r=i*e.height;t.width=62,t.height=62,n.clearRect(0,0,e.width,e.height),n.translate(0,.5*(t.height-r)),n.scale(i,i),n.drawImage(e,0,0);var o=t.toDataURL("image/png");return n.restore(),{data:o,width:62,height:r}}},{key:"addCustomStickerFromImage",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"none",r="data:image/svg"===e.src.substring(0,14),s=function(e,t){var n=e.x/e.y;return n>1?new a.Vector2(t,t/n):new a.Vector2(t*n,t)}(new a.Vector2(e.width,e.height),2048),l=r?s:function(){var t=n._ui.getEditor().getSDK().getRenderer(),i=new a.Vector2(e.width,e.height),r=1e6*n._ui.getEditor().getMaxMegapixels(),o=t.getMaxDimensions(),s=i.x*i.y>r,l=null!==o&&(i.x>o||i.y>o);if(s){var c=e.width/e.height,u=e.height/e.width;o=new a.Vector2(Math.sqrt(r*c),Math.sqrt(r*u)).floor().max()}var f=i.clone();return(s||l)&&(i.x/i.y>1?(f.x=o,f.y=o/i.x*i.y):(f.x=o/i.y*i.x,f.y=o)),f}(),c=this._customStickerCanvas,u=c.getContext("2d");u.save();var f=this.renderStickerThumbnailFromImage(e);r?(e.width>e.height?(c.width=2048,c.height=2048/e.width*e.height):(c.height=2048,c.width=2048/e.height*e.width),e.width=c.width,e.height=c.height):(c.width=l.x,c.height=l.y,u.scale(l.x/e.width,l.y/e.height)),u.drawImage(e,0,0,e.width,e.height);var p=c.toDataURL();u.restore();var d={identifier:o.Utils.generateUUID(),defaultName:t||"",tintMode:i,images:{mediaThumb:{uris:[f.data],rawData:!0,width:f.width,height:f.height},mediaBase:{uris:r?[p,e.src]:[p],rawData:!0,isSVG:r,width:l.x,height:l.y}}},h=this._dynamicAssetsLibrary;h.addAsset("sticker",d,!0);var _=h.getAssets("sticker");if(1===_.length){var m=this._createCustomStickerCategory(_);this._addCategories([m],!1,!0)}else this.getCategory("imgly_sticker_custom").stickers=_,this._updateAllCategory();this._updateCategoriesMap()}},{key:"_createCustomStickerCategory",value:function(e){return{identifier:"imgly_sticker_custom",defaultName:"Custom",metaData:{backgroundImage:e[e.length-1].images.mediaBase.uris[0],rawData:!0},stickers:e}}},{key:"getStickersForCategory",value:function(e){if(!this._categoriesById[e])throw new Error("Unknown sticker category '"+e+"'");return this._categoriesById[e].stickers}},{key:"getStickerByIdentifier",value:function(e){return this._stickersById[e]}},{key:"getCategories",value:function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?[this._allCategory].concat(this._categories):this._categories}},{key:"getCategory",value:function(e){return this._categoriesById[e]}}],[{key:"getURLForSticker",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"base",n=e.images,i="base"===t&&n.mediaBase||n.mediaThumb,r=i.uris||[i.uri];if(void 0===a.Utils.Browser||a.Utils.Browser.getIEVersion()){var o=r.filter(function(e){return!/\.svg$/i.test(e)});return o.length?o[0]:r[0]}var s=r.filter(function(e){return/\.svg$/i.test(e)});return s.length?s[0]:r[0]}}]),e}();t.default=u},function(e,t,n){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(0),s=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._ui=t,this._options=n,this._defaultLayouts=a.SDK.Operations.SpriteOperation.TextDesignSprite.Layouts,this._legacyLayouts=a.SDK.Operations.SpriteOperation.TextDesignSprite.LegacyLayouts,this._layouts=[],this._init()}return o(e,[{key:"_init",value:function(){var e=this._options.availableLayouts,t=r({},this._defaultLayouts,this._legacyLayouts);this._layouts=Object.keys(t).map(function(e){return{identifier:t[e].identifier,layout:t[e]}}),e&&(e.push.apply(e,i(Object.values(this._legacyLayouts).map(function(e){return e.identifier}))),this._layouts=this._layouts.filter(function(t){return e.indexOf(t.identifier)>=0}))}},{key:"getLayoutByIdentifier",value:function(e){var t=a.SDKUtils.Array.find(this._layouts,function(t){return t.identifier===e});return t&&t.layout}},{key:"getLayouts",value:function(){return[].concat(i(this._layouts))}},{key:"getDefaultLayout",value:function(){return this.getLayouts()[0]}}]),e}();t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"renderContent",value:function(){return this.props.children}},{key:"renderWithBEM",value:function(){return r.ReactBEM.createElement("div",{bem:"$b:topBar e:row"},r.ReactBEM.createElement("div",{bem:"e:cell"},this.renderContent()))}}]),t}();t.default=o,o.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=function(e){return e&&e.__esModule?e:{default:e}}(n(6)),s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._bindAll("_onKnobDragStart","_onKnobDrag","_onKnobDragStop","_onBarDragStart","_onBarDrag","_onBarDragStop","_onMiddleDotClick"),o.state={value:o.props.value||0,sliderPosition:0,foregroundLeft:0,foregroundWidth:0},o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.BaseComponent),r(t,[{key:"componentDidMount",value:function(){this._setValue(this.state.value,!1)}},{key:"componentWillReceiveProps",value:function(e){e.value!==this.state.value&&this._setValue(e.value,!1)}},{key:"_onMiddleDotClick",value:function(){this._previousValue=this.state.value;var e=this.props.minValue+(this.props.maxValue-this.props.minValue)/2;this._setValue(e,!0,!0)}},{key:"_onKnobDragStart",value:function(e){this._previousValue=this.state.value,this._initialSliderPosition=this.state.sliderPosition,this._initialPosition=e}},{key:"_onKnobDrag",value:function(e){var t=this.refs.bar.offsetWidth,n=this._initialSliderPosition+e.x,i=(n=Math.max(0,Math.min(n,t)))/t,r=this.props.minValue+(this.props.maxValue-this.props.minValue)*i;this._setValue(r)}},{key:"_onKnobDragStop",value:function(){this._setValue(this.state.value,!0,!0)}},{key:"_onBarDragStart",value:function(e){this._previousValue=this.state.value,this._initialPosition=e.clone();var t=this.refs.bar.offsetWidth,n=e.x/t,i=this.props.minValue+(this.props.maxValue-this.props.minValue)*n;this._setValue(i)}},{key:"_onBarDrag",value:function(e){var t=this._initialPosition.clone().add(e),n=this.refs.bar.offsetWidth,i=t.x/n,r=this.props.minValue+(this.props.maxValue-this.props.minValue)*i;r=Math.max(this.props.minValue,Math.min(this.props.maxValue,r)),this._setValue(r)}},{key:"_onBarDragStop",value:function(){this._setValue(this.state.value,!0,!0)}},{key:"_getKnobStyle",value:function(){return{left:this.state.sliderPosition}}},{key:"_getForegroundStyle",value:function(){return{left:this.state.foregroundLeft,width:this.state.foregroundWidth}}},{key:"_displayMiddleDot",value:function(){return!1!==this.props.middleDot}},{key:"_setValue",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e=Math.round(e);var i=this.props,r=i.minValue,o=(e-r)/(i.maxValue-r),a=this.refs.bar.offsetWidth,s=a*o,l=o*a,c=0;this._displayMiddleDot()&&(l=Math.abs(o-.5)*a,c=o<.5?.5*a-l:"50%"),this.setState({value:e,sliderPosition:s,foregroundWidth:l,foregroundLeft:c}),t&&this.props.onChange&&this.props.onChange(e,this._previousValue,n)}},{key:"_buildValue",value:function(e){return e%1!=0&&(e=e.toFixed(2)),this.props.positiveValuePrefix&&e>=0&&(e=""+this.props.positiveValuePrefix+e),this.props.valueUnit&&(e+=this.props.valueUnit),e}},{key:"renderWithBEM",value:function(){var e=null;this._displayMiddleDot()&&(e=o.ReactBEM.createElement("div",{bem:"e:middleDot",onClick:this._onMiddleDotClick}));var t={style:this._getForegroundStyle()},n="$b:slider"+(this.props.style?" m:"+this.props.style:"");return o.ReactBEM.createElement("div",{bem:n},o.ReactBEM.createElement("div",{bem:"$e:bar",ref:"bar"},o.ReactBEM.createElement(a.default,{onStart:this._onBarDragStart,onDrag:this._onBarDrag,onStop:this._onBarDragStop},o.ReactBEM.createElement("div",null,o.ReactBEM.createElement("div",{bem:"$e:background"}),o.ReactBEM.createElement("div",i({bem:"$e:foreground"},t)),o.ReactBEM.createElement(a.default,{onStart:this._onKnobDragStart,onDrag:this._onKnobDrag,onStop:this._onKnobDragStop},o.ReactBEM.createElement("div",{bem:"e:knob b:knob m:slider",style:this._getKnobStyle()})))),e),o.ReactBEM.createElement("div",{bem:"$e:labels"},o.ReactBEM.createElement("div",{bem:"e:label m:lowerBoundary"},this._buildValue(this.props.minValue)),o.ReactBEM.createElement("div",{bem:"e:label m:value"},this.props.label," ",this._buildValue(this.state.value)),o.ReactBEM.createElement("div",{bem:"e:label m:upperBoundary"},this._buildValue(this.props.maxValue))))}}]),t}();t.default=s,s.contextTypes=o.BaseComponent.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=n(0),l=i(n(151)),c=i(n(152)),u=i(n(153)),f=i(n(11)),p=s.SDK.Operations.SpriteOperation,d=p.StickerSprite,h=p.TextSprite,_=p.BrushSprite,m=function(e){function t(){var e,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,o=Array(i),a=0;a<i;a++)o[a]=arguments[a];var l=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(o)));return l._bindAll("_onCanvasClick","_onSpriteDragStart","_onSpriteDragStop","_onOperationUpdated","_onOperationRemoved","_onSpriteFlip","_onSpriteTakeToFront","_onSpriteRemove"),l._canvasClickDisabled=!1,l._events=(r(n={},s.Constants.EVENTS.OPERATION_UPDATED,l._onOperationUpdated),r(n,s.Constants.EVENTS.OPERATION_REMOVED,l._onOperationRemoved),n),l}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,f.default),a(t,[{key:"_onOperationRemoved",value:function(e){var t=this.getSharedState("selectedSprite");if(e===this.getSharedState("operation")&&t){var n=this.context.editor.operations.getOrCreate("sprite",{sprites:[t],enabled:!1});this.setSharedState({operation:n,operationExistedBefore:!1,initialOptions:{}})}}},{key:"_onOperationUpdated",value:function(e){var t=this.getSharedState("selectedSprite");if(e===this.getSharedState("operation")&&t){var n=e.getSprites();-1===n.indexOf(t)&&n.push(t),this.forceUpdate()}}},{key:"_onItemBlur",value:function(){}},{key:"_onCanvasClick",value:function(e){this._canvasClickDisabled||this._performHitTest(s.Utils.getEventPosition(e))||(this.getSharedState("selectedSprite")&&this._onItemBlur(),this.props.onSwitchControls("home"))}},{key:"_onSpriteFlip",value:function(e){var t=this.getSharedState("selectedSprite");switch(e){case"h":t.setFlipHorizontally(!t.getFlipHorizontally());break;case"v":t.setFlipVertically(!t.getFlipVertically())}this.context.editor.render()}},{key:"_onSpriteTakeToFront",value:function(e){this.getSharedState("operation").takeSpriteToFront(this.getSharedState("selectedSprite")),this.forceSharedUpdate(),this.context.editor.render()}},{key:"_onSpriteRemove",value:function(){var e=this.getSharedState("operation"),t=this.getSharedState("selectedSprite");e.removeSprite(t),t.dispose(),this.setSharedState({selectedSprite:null}),this.context.editor.render()}},{key:"_onSpriteDragStart",value:function(){this._canvasClickDisabled=!0}},{key:"_onSpriteDragStop",value:function(){var e=this;setTimeout(function(){e._canvasClickDisabled=!1},100)}},{key:"_getContainerStyle",value:function(){var e=this.context.editor,t=e.getCanvasDimensions(),n=e.getOutputDimensions(),i=t.clone().divide(2).subtract(n.clone().divide(2));return{left:i.x,top:i.y,width:n.x,height:n.y}}},{key:"_getContainerProps",value:function(){return{}}},{key:"_getInnerContainerProps",value:function(){return{style:this._getContainerStyle(),onClick:this._onCanvasClick}}},{key:"_getPropsForSprite",value:function(e){return{hideContent:!0}}},{key:"_getComponentTypeForSprite",value:function(e){return e instanceof h?l.default:e instanceof d?c.default:e instanceof _?u.default:void 0}},{key:"_renderSpriteItems",value:function(){var e=this,t=this.getSharedState("operation"),n=t.getSprites(),i=this.getSharedState("selectedSprite");return n.map(function(n){var r=n===i,a=e._getComponentTypeForSprite(n),l=e._getPropsForSprite(n);return s.ReactBEM.createElement(a,o({operation:t,sharedState:e.props.sharedState,sprite:n,selected:r,onDragStart:e._onSpriteDragStart,onDragStop:e._onSpriteDragStop,onRemove:e._onSpriteRemove.bind(e,n),options:e.props.options,ref:"sprite-"+n.getId()},l))})}},{key:"_renderOverlayControls",value:function(){return null}},{key:"renderWithBEM",value:function(){return s.ReactBEM.createElement("div",o({bem:"$b:canvasControls e:container m:full",ref:"container"},this._getContainerProps()),s.ReactBEM.createElement("div",o({bem:"b:canvasControls e:innerContainer",ref:"innerContainer"},this._getInnerContainerProps()),s.ReactBEM.createElement("div",{bem:"$b:spritesCanvasControls",ref:"container"},this._renderSpriteItems(),this._renderOverlayControls())))}}]),t}();t.default=m,m.contextTypes=f.default.contextTypes},function(e,t,n){"use strict";function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var r;Object.defineProperty(t,"__esModule",{value:!0});var o=n(0).SDK.Engine.Filters.OverlayFilter;t.default=(i(r={},o.BLEND_MODES.NORMAL,"normal"),i(r,o.BLEND_MODES.OVERLAY,"overlay"),i(r,o.BLEND_MODES.HARD_LIGHT,"hard light"),i(r,o.BLEND_MODES.SOFT_LIGHT,"soft light"),i(r,o.BLEND_MODES.MULTIPLY,"multiply"),i(r,o.BLEND_MODES.DARKEN,"darken"),i(r,o.BLEND_MODES.LIGHTEN,"lighten"),i(r,o.BLEND_MODES.SCREEN,"screen"),i(r,o.BLEND_MODES.COLOR_BURN,"color burn"),r)},function(e,n){e.exports=t},function(e,t,n){"use strict";(function(e){function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.Logger=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function(e){return e&&e.__esModule?e:{default:e}}(n(74)),a=[{name:"trace",type:"trace",background:"#EEEEEE",color:"#AAAAAA"},{name:"info",type:"log",background:"#BDE5F8",color:"#00529B"},{name:"warn",type:"warn",background:"#FEEFB3",color:"#9F6000"},{name:"error",type:"error",background:"#FFBABA",color:"#D8000C"},{name:"log",type:"log",background:"#EEEEEE",color:"#1f4f6b"}],s=function(){return console&&console.group&&console.groupCollapsed&&console.groupEnd},l=function(){function t(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"warn",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this._levels=[].concat(i(r)),this._maxLevel=this.getLevelIndexByName(n),this._consoleFuncs={trace:function(){var e,t;s()?((e=console).groupCollapsed.apply(e,arguments),console.trace(),console.groupEnd()):(t=console).trace.apply(t,arguments)}},this._levels.forEach(function(t){var n=t.name;e[n]=function(t){for(var i=arguments.length,r=Array(i>1?i-1:0),o=1;o<i;o++)r[o-1]=arguments[o];e._log.apply(e,[n,t].concat(r))}})}return r(t,[{key:"getLevelIndexByName",value:function(e){return o.default.Array.findIndex(this._levels,function(t){return t.name===e})}},{key:"getLevelObjectByName",value:function(e){return o.default.Array.find(this._levels,function(t){return t.name===e})}},{key:"canLog",value:function(e){var t=this.getLevelIndexByName(e);return!(t<0)&&t>=this._maxLevel}},{key:"setLevel",value:function(e){var t=this.getLevelIndexByName(e);t<0||(this._maxLevel=t)}},{key:"_log",value:function(t,n){for(var r=arguments.length,a=Array(r>2?r-2:0),l=2;l<r;l++)a[l-2]=arguments[l];var c=this.getLevelObjectByName(t);if(c&&this.canLog(t)){c.name;var u,f=c.type,p=c.background,d=c.color,h=a.filter(function(e){return void 0!==e}).map(function(e){return e.toObject?JSON.parse(JSON.stringify(e.toObject())):e}),_=this._consoleFuncs[f]||console[f]?function(){var e;return(e=console)[f].apply(e,arguments)}:function(){var e;return(e=console).log.apply(e,arguments)},m=h.length,y=function(e,t){return["background: #2D7BFF; line-height: 20px; padding: 4px 0","background: #2B2B2B; color: white; line-height: 20px; padding: 4px 0","background: #2D7BFF; line-height: 20px; padding: 4px 0","background: "+e+"; color: "+t+"; line-height: 20px; padding: 4px 0; font-weight: bold","background: #2B2B2B; color: white; line-height: 20px; padding: 4px 0","background: #2D7BFF; line-height: 20px; padding: 4px 0"]}(p,d);if(!(!e||e&&e.browser)||"undefined"==typeof navigator||!navigator.userAgent.match(/Gecko|WebKit/i)||navigator.userAgent.match(/Trident/)){var g=h.length;return g<=0?void _("PhotoEditorSDK | "+n+" "):1===g&&"string"==typeof h[0]?void _("PhotoEditorSDK | "+n+" | "+h[0]):void _.apply(void 0,["PhotoEditorSDK | "+n+" | "].concat(i(h)))}m<=0?_.apply(void 0,["%c  %c PhotoEditorSDK %c  %c "+n+" %c %c  "].concat(i(y))):1!==m||"string"!=typeof h[0]?s()?((u=console).groupCollapsed.apply(u,["%c  %c PhotoEditorSDK %c  %c "+n+" %c"].concat(i(o.default.Array.init(y)))),_.apply(void 0,i(h)),console.groupEnd()):_.apply(void 0,["%c  %c PhotoEditorSDK %c  %c "+n+" %c"].concat(i(o.default.Array.init(y)),i(h))):_.apply(void 0,["%c  %c PhotoEditorSDK %c  %c "+n+" %c  "+h[0]+"  %c  "].concat(i(y)))}}},{key:"image",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments[1],n=new window.Image,i=function(){var t=n.width,i=n.height;e&&console.log(e),console.log("%c+","\n        font-size: 1px;\n        padding: 0px "+Math.floor(t/2)+"px;\n        line-height: "+i+"px;\n        background: url("+n.src+");\n        color: transparent;\n        background-repeat: no-repeat;\n        background-size: "+t+"px "+i+"px;")};return n.onload=i,t instanceof window.HTMLCanvasElement?n.src=t.toDataURL():t instanceof window.Image?(n=t,i()):"string"==typeof t?n.src=t:this.log(e,t),n}},{key:"texture",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments[1];if(t){var n=t.getBaseTexture(),i=n.getRenderers(),r=o.default.Array.find(i,function(e){return e&&"WebGL"===e.constructor.type}),a=n.getFrame(),s=a.width,l=a.height;if(r){var u=r.getContext(),f=n.getGLTextureForRenderer(r);this.logGlTexture(u,f,s,l,e)}else c.image(e,n.getSource())}else this.log(e,"texture: null or undefined")}},{key:"logGlTexture",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:150,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:150,r=arguments[4];e.bindTexture(e.TEXTURE_2D,t);var o=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,o),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0);var a=new Uint8Array(n*i*4);e.readPixels(0,0,n,i,e.RGBA,e.UNSIGNED_BYTE,a),e.deleteFramebuffer(o);var s=document.createElement("canvas");s.width=n,s.height=i;var l=s.getContext("2d"),u=l.createImageData(n,i);return u.data.set(a),l.putImageData(u,0,0),c.image(r,s)}}]),t}();t.Logger=l;var c=new l("warn");t.default=c}).call(t,n(20))},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function r(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function o(){h&&p&&(h=!1,p.length?d=p.concat(d):_=-1,d.length&&a())}function a(){if(!h){var e=r(o);h=!0;for(var t=d.length;t;){for(p=d,d=[];++_<t;)p&&p[_].run();_=-1,t=d.length}p=null,h=!1,function(e){if(u===clearTimeout)return clearTimeout(e);if((u===i||!u)&&clearTimeout)return u=clearTimeout,clearTimeout(e);try{u(e)}catch(t){try{return u.call(null,e)}catch(t){return u.call(this,e)}}}(e)}}function s(e,t){this.fun=e,this.array=t}function l(){}var c,u,f=e.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:n}catch(e){c=n}try{u="function"==typeof clearTimeout?clearTimeout:i}catch(e){u=i}}();var p,d=[],h=!1,_=-1;f.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];d.push(new s(e,t)),1!==d.length||h||r(a)},s.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=l,f.addListener=l,f.once=l,f.off=l,f.removeListener=l,f.removeAllListeners=l,f.emit=l,f.prependListener=l,f.prependOnceListener=l,f.listeners=function(e){return[]},f.binding=function(e){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(e){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},function(e,t,n){"use strict";(function(e){function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=i(n(78)),a=i(n(81)),s="undefined"!=typeof window?window:e,l=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._url=t,this._parsedUrl=a.default.parse(this._url,!0)}return r(e,[{key:"_isJSONPRequest",value:function(){var e=this._parsedUrl.query;for(var t in e)if("?"===e[t])return!0;return!1}},{key:"load",value:function(){return this._isJSONPRequest()?this._loadJSONP():this._loadJSON()}},{key:"_loadJSON",value:function(){var e=this;return new o.default(function(t,n){var i=void 0;s.XDomainRequest?((i=new s.XDomainRequest).onload=function(){var e=JSON.parse(i.responseText);t(e)},i.onerror=function(e){n(e)},i.open("GET",e._url,!0),i.send()):s.XMLHttpRequest&&((i=new XMLHttpRequest).onreadystatechange=function(e){if(4===i.readyState)if(200===i.status){var r=JSON.parse(i.responseText);t(r)}else n(new Error("HTTP Status "+i.status))},i.open("GET",e._url,!0),i.send())})}},{key:"_loadJSONP",value:function(){var e=this,t=!1,n=!1,i="pesdk"+Math.round(99999999999999*Math.random());return new o.default(function(r,o){var a=e._createJSONPNode(i);s[i]=function(i){e._removeJSONPNode(a),t||(n=!0,r(i))},s.setTimeout(function(){n||(e._removeJSONPNode(a),t=!0,o(new Error("Timeout of 5 seconds exceeded.")))},5e3)})}},{key:"_createJSONPNode",value:function(e){var t=this._buildJSONPUrl(e),n=document.querySelector("head"),i=document.createElement("script");return i.src=t,n.appendChild(i),i}},{key:"_removeJSONPNode",value:function(e){e.parentNode.removeChild(e)}},{key:"_buildJSONPUrl",value:function(e){var t=this._parsedUrl.query,n=null;for(var i in t)if("?"===t[i]){n=i;break}return delete this._parsedUrl.search,t[n]=e,a.default.format(this._parsedUrl)}}]),e}();t.default=l}).call(t,n(8))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Events=void 0;var i=function(e){return e&&e.__esModule?e:{default:e}}(n(90));t.Events={EXPORT:"export",CLOSE:"close",OPERATION_CREATED:"operation:created",OPERATION_UPDATED:"operation:updated",OPERATION_REMOVED:"operation:removed",EDITOR_READY:"editor:ready",WINDOW_RESIZE:"window:resize",ZOOM_DONE:"editor:zoom_done",HISTORY_UNDO:"history:undo",HISTORY_UPDATED:"history:update",FEATURES_DISABLED:"editor:features:disabled",FEATURES_ENABLED:"editor:features:enabled",FEATURES_UPDATED:"editor:features:updated",TRANSFORM_REAPPLY_RATIO:"transform:reapply_ratio"},t.default={DEFAULTS:{ART_FILTERS:i.default,FILTERS:[{identifier:"imgly_filters_duotone",defaultName:"DuoTone",assetFileName:"duotone",filters:[{identifier:"imgly_duotone_desert",defaultName:"Desert",lightColor:"#e1de9a",darkColor:"#cb2129"},{identifier:"imgly_duotone_peach",defaultName:"Peach",lightColor:"#e9abb8",darkColor:"#0040ff"},{identifier:"imgly_duotone_clash",defaultName:"Clash",lightColor:"#f41a0f",darkColor:"#23007c"},{identifier:"imgly_duotone_plum",defaultName:"Plum",lightColor:"#74d7ff",darkColor:"#23007c"},{identifier:"imgly_duotone_breezy",defaultName:"Breezy",lightColor:"#68fdff",darkColor:"#c20000"},{identifier:"imgly_duotone_deepblue",defaultName:"Deep Blue",lightColor:"#2de9eb",darkColor:"#58007c"},{identifier:"imgly_duotone_frog",defaultName:"Frog",lightColor:"#5bff60",darkColor:"#7f23a9"},{identifier:"imgly_duotone_sunset",defaultName:"Sunset",lightColor:"#f8ea46",darkColor:"#c400be"}]},{identifier:"imgly_filters_bw",assetFileName:"b&w",defaultName:"Black & White",filters:[{identifier:"imgly_lut_ad1920",defaultName:"1920 A.D.",lutImage:"filters/imgly_lut_ad1920_5_5_128.png"},{identifier:"imgly_lut_bw",defaultName:"Greyed",lutImage:"filters/imgly_lut_bw_5_5_128.png"},{identifier:"imgly_lut_x400",defaultName:"Dusty",lutImage:"filters/imgly_lut_dusty_5_5_128.png"},{identifier:"imgly_lut_litho",defaultName:"Litho",lutImage:"filters/imgly_lut_litho_5_5_128.png"},{identifier:"imgly_lut_sepiahigh",defaultName:"Sepia",lutImage:"filters/imgly_lut_sepia_5_5_128.png"},{identifier:"imgly_lut_plate",defaultName:"Weathered",lutImage:"filters/imgly_lut_weathered_5_5_128.png"},{identifier:"imgly_lut_sin",defaultName:"Hard Stuff",lutImage:"filters/imgly_lut_hard_stuff_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8}]},{identifier:"imgly_filters_retro",assetFileName:"vintage",defaultName:"Vintage",filters:[{identifier:"imgly_lut_blues",defaultName:"Polaroid",lutImage:"filters/imgly_lut_polaroid_5_5_128.png"},{identifier:"imgly_lut_front",defaultName:"Sunny 70s",lutImage:"filters/imgly_lut_sunny_70s_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_texas",defaultName:"Oldtimer",lutImage:"filters/imgly_lut_oldtimer_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_celsius",defaultName:"Inferno",lutImage:"filters/imgly_lut_inferno_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_cool",defaultName:"Snappy",lutImage:"filters/imgly_lut_snappy_5_5_128.png"}]},{identifier:"imgly_filters_analog",assetFileName:"smooth",defaultName:"Smooth",filters:[{identifier:"imgly_lut_chest",defaultName:"Chestnut",lutImage:"filters/imgly_lut_chestnut_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_winter",defaultName:"Softly",lutImage:"filters/imgly_lut_softly_5_5_128.png"},{identifier:"imgly_lut_kdynamic",defaultName:"Pebble",lutImage:"filters/imgly_lut_pebble_5_5_128.png"},{identifier:"imgly_lut_fall",defaultName:"Moss",lutImage:"filters/imgly_lut_moss_5_5_128.png"},{identifier:"imgly_lut_lenin",defaultName:"Lemon",lutImage:"filters/imgly_lut_lemon_5_5_128.png"},{identifier:"imgly_lut_pola669",defaultName:"Green Gap",lutImage:"filters/imgly_lut_green_gap_5_5_128.png"}]},{identifier:"imgly_filters_winter",assetFileName:"cold",defaultName:"Cold",filters:[{identifier:"imgly_lut_elder",defaultName:"Colla",lutImage:"filters/imgly_lut_colla_5_5_128.png"},{identifier:"imgly_lut_orchid",defaultName:"Solanus",lutImage:"filters/imgly_lut_solanus_5_5_128.png"},{identifier:"imgly_lut_bleached",defaultName:"Kalmen",lutImage:"filters/imgly_lut_kalmen_5_5_128.png"},{identifier:"imgly_lut_bleachedblue",defaultName:"Joran",lutImage:"filters/imgly_lut_joran_5_5_128.png"},{identifier:"imgly_lut_breeze",defaultName:"Levante",lutImage:"filters/imgly_lut_levante_5_5_128.png"},{identifier:"imgly_lut_blueshadows",defaultName:"Zephyr",lutImage:"filters/imgly_lut_zephyr_5_5_128.png"}]},{identifier:"imgly_filters_summer",assetFileName:"warm",defaultName:"Warm",filters:[{identifier:"imgly_lut_sunset",defaultName:"Golden",lutImage:"filters/imgly_lut_golden_5_5_128.png"},{identifier:"imgly_lut_eighties",defaultName:"Low Fire",lutImage:"filters/imgly_lut_low_fire_5_5_128.png"},{identifier:"imgly_lut_evening",defaultName:"Sunrise",lutImage:"filters/imgly_lut_sunrise_5_5_128.png"},{identifier:"imgly_lut_k2",defaultName:"Flat Black",lutImage:"filters/imgly_lut_flat_black_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_nogreen",defaultName:"Pumpkin",lutImage:"filters/imgly_lut_pumpkin_5_5_128.png"}]},{identifier:"imgly_filters_legacy",defaultName:"Legacy",assetFileName:"legacy",filters:[{identifier:"imgly_lut_ancient",defaultName:"Ancient",lutImage:"filters/imgly_lut_ancient_5_5_128.png"},{identifier:"imgly_lut_cottoncandy",defaultName:"Candy",lutImage:"filters/imgly_lut_cottoncandy_5_5_128.png"},{identifier:"imgly_lut_classic",defaultName:"Classic",lutImage:"filters/imgly_lut_classic_5_5_128.png"},{identifier:"imgly_lut_colorful",defaultName:"Colorful",lutImage:"filters/imgly_lut_colorful_5_5_128.png"},{identifier:"imgly_lut_creamy",defaultName:"Creamy",lutImage:"filters/imgly_lut_creamy_5_5_128.png"},{identifier:"imgly_lut_fixie",defaultName:"Fixie",lutImage:"filters/imgly_lut_fixie_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_food",defaultName:"Food",lutImage:"filters/imgly_lut_food_5_5_128.png"},{identifier:"imgly_lut_fridge",defaultName:"Fridge",lutImage:"filters/imgly_lut_fridge_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_glam",defaultName:"Glam",lutImage:"filters/imgly_lut_glam_5_5_128.png"},{identifier:"imgly_lut_gobblin",defaultName:"Gobblin",lutImage:"filters/imgly_lut_gobblin_5_5_128.png"},{identifier:"imgly_lut_highcontrast",defaultName:"Hicon",lutImage:"filters/imgly_lut_highcontrast_5_5_128.png"},{identifier:"imgly_lut_highcarb",defaultName:"High Carb",lutImage:"filters/imgly_lut_highcarb_5_5_128.png"},{identifier:"imgly_lut_k1",defaultName:"K1",lutImage:"filters/imgly_lut_k1_5_5_128.png"},{identifier:"imgly_lut_k6",defaultName:"K6",lutImage:"filters/imgly_lut_k6_5_5_128.png"},{identifier:"imgly_lut_keen",defaultName:"Keen",lutImage:"filters/imgly_lut_keen_5_5_128.png"},{identifier:"imgly_lut_lomo",defaultName:"Lomo",lutImage:"filters/imgly_lut_lomo_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_lomo100",defaultName:"Lomo 100",lutImage:"filters/imgly_lut_lomo100_5_5_128.png"},{identifier:"imgly_lut_lucid",defaultName:"Lucid",lutImage:"filters/imgly_lut_lucid_5_5_128.png"},{identifier:"imgly_lut_mellow",defaultName:"Mellow",lutImage:"filters/imgly_lut_mellow_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_neat",defaultName:"Neat",lutImage:"filters/imgly_lut_neat_5_5_128.png"},{identifier:"imgly_lut_pale",defaultName:"Pale",lutImage:"filters/imgly_lut_pale_5_5_128.png"},{identifier:"imgly_lut_pitched",defaultName:"Pitched",lutImage:"filters/imgly_lut_pitched_5_5_128.png"},{identifier:"imgly_lut_polasx",defaultName:"Pola SX",lutImage:"filters/imgly_lut_polasx_5_5_128.png"},{identifier:"imgly_lut_pro400",defaultName:"Pro 400",lutImage:"filters/imgly_lut_pro400_5_5_128.png"},{identifier:"imgly_lut_quozi",defaultName:"Quozi",lutImage:"filters/imgly_lut_quozi_5_5_128.png"},{identifier:"imgly_lut_settled",defaultName:"Settled",lutImage:"filters/imgly_lut_settled_5_5_128.png"},{identifier:"imgly_lut_seventies",defaultName:"Seventies",lutImage:"filters/imgly_lut_seventies_5_5_128.png"},{identifier:"imgly_lut_soft",defaultName:"Soft",lutImage:"filters/imgly_lut_soft_5_5_128.png"},{identifier:"imgly_lut_steel",defaultName:"Steel",lutImage:"filters/imgly_lut_steel_5_5_128.png"},{identifier:"imgly_lut_summer",defaultName:"Summer",lutImage:"filters/imgly_lut_summer_5_5_128.png"},{identifier:"imgly_lut_tender",defaultName:"Tender",lutImage:"filters/imgly_lut_tender_5_5_128.png"},{identifier:"imgly_lut_twilight",defaultName:"Twilight",lutImage:"filters/imgly_lut_twilight_5_5_128.png"}]}],OVERLAYS:[{identifier:"imgly_overlay_golden",defaultName:"Golden",image:"overlays/imgly_overlay_golden.jpg",thumbnail:"overlays/imgly_overlay_golden_thumb.jpg",blendMode:"lighten"},{identifier:"imgly_overlay_bokeh",defaultName:"Bokeh",image:"overlays/imgly_overlay_bokeh.jpg",thumbnail:"overlays/imgly_overlay_bokeh_thumb.jpg",blendMode:"lighten"},{identifier:"imgly_overlay_hearts",defaultName:"Hearts",image:"overlays/imgly_overlay_hearts.jpg",thumbnail:"overlays/imgly_overlay_hearts_thumb.jpg",blendMode:"screen"},{identifier:"imgly_overlay_lightleak1",defaultName:"Light Leak",image:"overlays/imgly_overlay_lightleak1.jpg",thumbnail:"overlays/imgly_overlay_lightleak1_thumb.jpg",blendMode:"screen"},{identifier:"imgly_overlay_lightleak2",defaultName:"Light Leak 2",image:"overlays/imgly_overlay_lightleak2.jpg",thumbnail:"overlays/imgly_overlay_lightleak2_thumb.jpg",blendMode:"lighten"},{identifier:"imgly_overlay_rain",defaultName:"Rain",image:"overlays/imgly_overlay_rain.jpg",thumbnail:"overlays/imgly_overlay_rain_thumb.jpg",blendMode:"overlay"},{identifier:"imgly_overlay_wood",defaultName:"Wood",image:"overlays/imgly_overlay_wood.jpg",thumbnail:"overlays/imgly_overlay_wood_thumb.jpg",blendMode:"multiply"},{identifier:"imgly_overlay_mosaic",defaultName:"Mosaic",image:"overlays/imgly_overlay_mosaic.jpg",thumbnail:"overlays/imgly_overlay_mosaic_thumb.jpg",blendMode:"multiply"},{identifier:"imgly_overlay_chop",defaultName:"Chop",image:"overlays/imgly_overlay_chop.jpg",thumbnail:"overlays/imgly_overlay_chop_thumb.jpg",blendMode:"multiply"},{identifier:"imgly_overlay_vintage",defaultName:"Vintage",image:"overlays/imgly_overlay_vintage.jpg",thumbnail:"overlays/imgly_overlay_vintage_thumb.jpg",blendMode:"darken"},{identifier:"imgly_overlay_metal",defaultName:"Metal",image:"overlays/imgly_overlay_metal.jpg",thumbnail:"overlays/imgly_overlay_metal_thumb.jpg",blendMode:"overlay"},{identifier:"imgly_overlay_paper",defaultName:"Paper",image:"overlays/imgly_overlay_paper.jpg",thumbnail:"overlays/imgly_overlay_paper_thumb.jpg",blendMode:"multiply"},{identifier:"imgly_overlay_painting",defaultName:"Painting",image:"overlays/imgly_overlay_painting.jpg",thumbnail:"overlays/imgly_overlay_painting_thumb.jpg",blendMode:"overlay"},{identifier:"imgly_overlay_grain",defaultName:"Grain",image:"overlays/imgly_overlay_grain.jpg",thumbnail:"overlays/imgly_overlay_grain_thumb.jpg",blendMode:"overlay"},{identifier:"imgly_overlay_clouds",defaultName:"Clouds",image:"overlays/imgly_overlay_clouds.jpg",thumbnail:"overlays/imgly_overlay_clouds_thumb.jpg",blendMode:"softLight"},{identifier:"imgly_overlay_wall1",defaultName:"Wall",image:"overlays/imgly_overlay_wall1.jpg",thumbnail:"overlays/imgly_overlay_wall1_thumb.jpg",blendMode:"lighten"},{identifier:"imgly_overlay_wall2",defaultName:"Wall 2",image:"overlays/imgly_overlay_wall2.jpg",thumbnail:"overlays/imgly_overlay_wall2_thumb.jpg",blendMode:"overlay"}],FRAME_CATEGORIES:[{identifier:"imgly_frame_generic",defaultName:"Generic",metaData:{backgroundImage:"frames/generic.png"},frames:[{identifier:"imgly_frame_dia",defaultName:"Dia",layoutMode:"horizontal-inside",thumbnail:"frames/imgly_frame_dia/imgly_frame_dia_thumb.png",imageGroups:{top:{mid:{image:"frames/imgly_frame_dia/imgly_frame_dia_top.png",mode:"repeat"}},left:{start:"frames/imgly_frame_dia/imgly_frame_dia_top_corner_left.png",mid:"frames/imgly_frame_dia/imgly_frame_dia_left.png",end:"frames/imgly_frame_dia/imgly_frame_dia_bottom_corner_left.png"},right:{start:"frames/imgly_frame_dia/imgly_frame_dia_top_corner_right.png",mid:"frames/imgly_frame_dia/imgly_frame_dia_right.png",end:"frames/imgly_frame_dia/imgly_frame_dia_bottom_corner_right.png"},bottom:{mid:{image:"frames/imgly_frame_dia/imgly_frame_dia_bottom.png",mode:"repeat"}}}},{identifier:"imgly_frame_art_decor",defaultName:"Art Decor",tintable:!0,layoutMode:"horizontal-inside",thumbnail:"frames/imgly_frame_art_decor/imgly_frame_art_decor_thumb.png",imageGroups:{top:{start:"frames/imgly_frame_art_decor/imgly_frame_art_decor_top_corner_left.png",mid:{image:"frames/imgly_frame_art_decor/imgly_frame_art_decor_top.png",mode:"stretch"},end:"frames/imgly_frame_art_decor/imgly_frame_art_decor_top_corner_right.png"},left:{mid:{image:"frames/imgly_frame_art_decor/imgly_frame_art_decor_left.png",mode:"stretch"}},right:{mid:{image:"frames/imgly_frame_art_decor/imgly_frame_art_decor_right.png",mode:"stretch"}},bottom:{start:"frames/imgly_frame_art_decor/imgly_frame_art_decor_bottom_corner_left.png",mid:{image:"frames/imgly_frame_art_decor/imgly_frame_art_decor_bottom.png",mode:"stretch"},end:"frames/imgly_frame_art_decor/imgly_frame_art_decor_bottom_corner_right.png"}}},{identifier:"imgly_frame_black_passepartout",defaultName:"Black Passepartout",layoutMode:"horizontal-inside",thumbnail:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_thumb.png",imageGroups:{top:{start:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_top_corner_left.png",mid:{image:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_top.png",mode:"stretch"},end:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_top_corner_right.png"},left:{mid:{image:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_left.png",mode:"stretch"}},right:{mid:{image:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_right.png",mode:"stretch"}},bottom:{start:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_bottom_corner_left.png",mid:{image:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_bottom.png",mode:"stretch"},end:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_bottom_corner_right.png"}}},{identifier:"imgly_frame_lowpoly_shadow",defaultName:"Low Poly",layoutMode:"horizontal-inside",thumbnail:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_thumb.png",imageGroups:{top:{start:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_top_corner_left.png",mid:{image:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_top.png",mode:"stretch"},end:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_top_corner_right.png"},left:{mid:{image:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_left.png",mode:"stretch"}},right:{mid:{image:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_right.png",mode:"stretch"}},bottom:{start:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_bottom_corner_left.png",mid:{image:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_bottom.png",mode:"stretch"},end:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_bottom_corner_right.png"}}},{identifier:"imgly_frame_wood_passepartout",defaultName:"Wood Passepartout",layoutMode:"horizontal-inside",thumbnail:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_thumb.png",imageGroups:{top:{start:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_top_corner_left.png",mid:{image:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_top.png",mode:"stretch"},end:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_top_corner_right.png"},left:{mid:{image:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_left.png",mode:"stretch"}},right:{mid:{image:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_right.png",mode:"stretch"}},bottom:{start:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_bottom_corner_left.png",mid:{image:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_bottom.png",mode:"stretch"},end:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_bottom_corner_right.png"}}}]}],STICKER_CATEGORIES:[{identifier:"imgly_sticker_emoticons",defaultName:"Emoticons",metaData:{backgroundImage:"stickers/emoticons/background.png"},stickers:[{identifier:"imgly_sticker_emoticons_alien",defaultName:"Alien",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_alien.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_alien.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_alien.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_alien.png"],width:1e3,height:935}}},{identifier:"imgly_sticker_emoticons_angel",defaultName:"Angel",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_angel.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_angel.png"],width:62,height:64},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_angel.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_angel.png"]}}},{identifier:"imgly_sticker_emoticons_angry",defaultName:"Angry",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_angry.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_angry.png"],width:62,height:62},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_angry.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_angry.png"]}}},{identifier:"imgly_sticker_emoticons_anxious",defaultName:"Anxious",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_anxious.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_anxious.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_anxious.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_anxious.png"]}}},{identifier:"imgly_sticker_emoticons_asleep",defaultName:"Asleep",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_asleep.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_asleep.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_asleep.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_asleep.png"]}}},{identifier:"imgly_sticker_emoticons_attention",defaultName:"Attention",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_attention.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_attention.png"],width:62,height:60},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_attention.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_attention.png"]}}},{identifier:"imgly_sticker_emoticons_baby_chicken",defaultName:"Baby Chicken",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_baby_chicken.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_baby_chicken.png"],width:61,height:42},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_baby_chicken.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_baby_chicken.png"]}}},{identifier:"imgly_sticker_emoticons_batman",defaultName:"Batman",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_batman.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_batman.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_batman.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_batman.png"]}}},{identifier:"imgly_sticker_emoticons_beer",defaultName:"Beer",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_beer.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_beer.png"],width:62,height:59},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_beer.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_beer.png"]}}},{identifier:"imgly_sticker_emoticons_blush",defaultName:"Blush",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_blush.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_blush.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_blush.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_blush.png"]}}},{identifier:"imgly_sticker_emoticons_boxer",defaultName:"Boxer",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_boxer.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_boxer.png"],width:62,height:62},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_boxer.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_boxer.png"]}}},{identifier:"imgly_sticker_emoticons_business",defaultName:"Business",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_business.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_business.png"],width:60,height:63},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_business.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_business.png"]}}},{identifier:"imgly_sticker_emoticons_chicken",defaultName:"Chicken",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_chicken.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_chicken.png"],width:63,height:55},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_chicken.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_chicken.png"]}}},{identifier:"imgly_sticker_emoticons_cool",defaultName:"Cool",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_cool.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_cool.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_cool.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_cool.png"]}}},{identifier:"imgly_sticker_emoticons_cry",defaultName:"Cry",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_cry.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_cry.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_cry.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_cry.png"]}}},{identifier:"imgly_sticker_emoticons_deceased",defaultName:"Deceased",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_deceased.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_deceased.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_deceased.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_deceased.png"]}}},{identifier:"imgly_sticker_emoticons_devil",defaultName:"Devil",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_devil.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_devil.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_devil.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_devil.png"]}}},{identifier:"imgly_sticker_emoticons_duckface",defaultName:"Duckface",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_duckface.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_duckface.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_duckface.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_duckface.png"]}}},{identifier:"imgly_sticker_emoticons_furious",defaultName:"Furious",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_furious.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_furious.png"],width:62,height:61},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_furious.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_furious.png"]}}},{identifier:"imgly_sticker_emoticons_grin",defaultName:"Grin",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_grin.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_grin.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_grin.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_grin.png"]}}},{identifier:"imgly_sticker_emoticons_guitar",defaultName:"Guitar",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_guitar.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_guitar.png"],width:64,height:60},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_guitar.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_guitar.png"]}}},{identifier:"imgly_sticker_emoticons_harry_potter",defaultName:"Harry Potter",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_harry_potter.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_harry_potter.png"],width:64,height:62},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_harry_potter.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_harry_potter.png"]}}},{identifier:"imgly_sticker_emoticons_hippie",defaultName:"Hippie",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_hippie.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_hippie.png"],width:62,height:62},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_hippie.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_hippie.png"]}}},{identifier:"imgly_sticker_emoticons_hitman",defaultName:"Hitman",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_hitman.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_hitman.png"],width:64,height:60},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_hitman.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_hitman.png"]}}},{identifier:"imgly_sticker_emoticons_humourous",defaultName:"Humourous",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_humourous.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_humourous.png"],width:64,height:64},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_humourous.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_humourous.png"]}}},{identifier:"imgly_sticker_emoticons_idea",defaultName:"Idea",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_idea.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_idea.png"],width:64,height:62},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_idea.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_idea.png"]}}},{identifier:"imgly_sticker_emoticons_impatient",defaultName:"Impatient",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_impatient.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_impatient.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_impatient.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_impatient.png"]}}},{identifier:"imgly_sticker_emoticons_kiss",defaultName:"Kiss",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_kiss.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_kiss.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_kiss.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_kiss.png"]}}},{identifier:"imgly_sticker_emoticons_kisses",defaultName:"Kisses",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_kisses.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_kisses.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_kisses.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_kisses.png"]}}},{identifier:"imgly_sticker_emoticons_laugh",defaultName:"Laugh",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_laugh.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_laugh.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_laugh.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_laugh.png"]}}},{identifier:"imgly_sticker_emoticons_loud_cry",defaultName:"Loud Cry",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_loud_cry.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_loud_cry.png"],width:64,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_loud_cry.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_loud_cry.png"]}}},{identifier:"imgly_sticker_emoticons_loving",defaultName:"Loving",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_loving.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_loving.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_loving.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_loving.png"]}}},{identifier:"imgly_sticker_emoticons_masked",defaultName:"Masked",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_masked.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_masked.png"],width:62,height:62},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_masked.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_masked.png"]}}},{identifier:"imgly_sticker_emoticons_music",defaultName:"Music",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_music.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_music.png"],width:62,height:54},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_music.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_music.png"]}}},{identifier:"imgly_sticker_emoticons_nerd",defaultName:"Nerd",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_nerd.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_nerd.png"]},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_nerd.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_nerd.png"]}}},{identifier:"imgly_sticker_emoticons_ninja",defaultName:"Ninja",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_ninja.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_ninja.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_ninja.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_ninja.png"]}}},{identifier:"imgly_sticker_emoticons_not_speaking_to_you",defaultName:"Not Speaking To You",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_not_speaking_to_you.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_not_speaking_to_you.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_not_speaking_to_you.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_not_speaking_to_you.png"]}}},{identifier:"imgly_sticker_emoticons_pig",defaultName:"Pig",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_pig.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_pig.png"],width:63,height:41},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_pig.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_pig.png"]}}},{identifier:"imgly_sticker_emoticons_pumpkin",defaultName:"Pumpkin",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_pumpkin.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_pumpkin.png"],width:62,height:60},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_pumpkin.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_pumpkin.png"]}}},{identifier:"imgly_sticker_emoticons_question",defaultName:"Question",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_question.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_question.png"],width:62,height:62},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_question.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_question.png"]}}},{identifier:"imgly_sticker_emoticons_rabbit",defaultName:"Rabbit",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_rabbit.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_rabbit.png"],width:65,height:47},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_rabbit.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_rabbit.png"]}}},{identifier:"imgly_sticker_emoticons_sad",defaultName:"Sad",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sad.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_sad.png"]},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sad.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_sad.png"]}}},{identifier:"imgly_sticker_emoticons_sick",defaultName:"Sick",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sick.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_sick.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sick.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_sick.png"]}}},{identifier:"imgly_sticker_emoticons_skateboard",defaultName:"Skateboard",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_skateboard.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_skateboard.png"],width:62,height:64},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_skateboard.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_skateboard.png"]}}},{identifier:"imgly_sticker_emoticons_skull",defaultName:"Skull",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_skull.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_skull.png"],width:62,height:62},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_skull.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_skull.png"]}}},{identifier:"imgly_sticker_emoticons_sleepy",defaultName:"Sleepy",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sleepy.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_sleepy.png"],width:62,height:60},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sleepy.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_sleepy.png"]}}},{identifier:"imgly_sticker_emoticons_smile",defaultName:"Smile",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_smile.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_smile.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_smile.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_smile.png"]}}},{identifier:"imgly_sticker_emoticons_smoking",defaultName:"Smoking",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_smoking.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_smoking.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_smoking.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_smoking.png"]}}},{identifier:"imgly_sticker_emoticons_sobbing",defaultName:"Sobbing",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sobbing.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_sobbing.png"],width:62,height:59},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sobbing.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_sobbing.png"]}}},{identifier:"imgly_sticker_emoticons_star",defaultName:"Star",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_star.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_star.png"],width:64,height:64},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_star.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_star.png"]}}},{identifier:"imgly_sticker_emoticons_steaming_furious",defaultName:"Steaming Furious",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_steaming_furious.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_steaming_furious.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_steaming_furious.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_steaming_furious.png"]}}},{identifier:"imgly_sticker_emoticons_sunbathing",defaultName:"Sunbathing",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sunbathing.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_sunbathing.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sunbathing.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_sunbathing.png"]}}},{identifier:"imgly_sticker_emoticons_tired",defaultName:"Tired",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_tired.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_tired.png"],width:62,height:60},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_tired.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_tired.png"]}}},{identifier:"imgly_sticker_emoticons_tongue_out_wink",defaultName:"Tongue Out Wink",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_tongue_out_wink.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_tongue_out_wink.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_tongue_out_wink.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_tongue_out_wink.png"]}}},{identifier:"imgly_sticker_emoticons_wave",defaultName:"Wave",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_wave.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_wave.png"],width:62,height:60},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_wave.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_wave.png"]}}},{identifier:"imgly_sticker_emoticons_wide_grin",defaultName:"Wide Grin",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_wide_grin.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_wide_grin.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_wide_grin.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_wide_grin.png"]}}},{identifier:"imgly_sticker_emoticons_wink",defaultName:"Wink",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_wink.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_wink.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_wink.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_wink.png"]}}},{identifier:"imgly_sticker_emoticons_wrestler",defaultName:"Wrestler",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_wrestler.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_wrestler.png"],width:62,height:60},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_wrestler.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_wrestler.png"]}}}]},{identifier:"imgly_sticker_shapes",defaultName:"Shapes",metaData:{backgroundImage:"stickers/shapes/background.png"},stickers:[{identifier:"imgly_sticker_shapes_arrow_02",defaultName:"Arrow 1",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_arrow_02.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_arrow_02.png"],width:2e3,height:1236},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_arrow_02.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_arrow_02.png"],width:2e3,height:1236}}},{identifier:"imgly_sticker_shapes_arrow_03",defaultName:"Arrow 2",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_arrow_03.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_arrow_03.png"],width:2e3,height:2e3},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_arrow_03.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_arrow_03.png"],width:2e3,height:2e3}}},{identifier:"imgly_sticker_shapes_badge_01",defaultName:"Badge 1",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_01.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_01.png"],width:2e3,height:2e3},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_01.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_01.png"],width:2e3,height:2e3}}},{identifier:"imgly_sticker_shapes_badge_04",defaultName:"Badge 2",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_04.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_04.png"],width:2e3,height:1589},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_04.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_04.png"],width:2e3,height:1589}}},{identifier:"imgly_sticker_shapes_badge_06",defaultName:"Badge 3",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_06.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_06.png"],width:2e3,height:1733},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_06.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_06.png"],width:2e3,height:1733}}},{identifier:"imgly_sticker_shapes_badge_08",defaultName:"Badge 4",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_08.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_08.png"],width:2e3,height:2e3},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_08.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_08.png"],width:2e3,height:2e3}}},{identifier:"imgly_sticker_shapes_badge_11",defaultName:"Badge 5",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_11.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_11.png"],width:2e3,height:2e3},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_11.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_11.png"],width:2e3,height:2e3}}},{identifier:"imgly_sticker_shapes_badge_12",defaultName:"Badge 6",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_12.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_12.png"],width:2001,height:1903},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_12.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_12.png"],width:2001,height:1903}}},{identifier:"imgly_sticker_shapes_badge_13",defaultName:"Badge 7",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_13.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_13.png"],width:2e3,height:1718},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_13.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_13.png"],width:2e3,height:1718}}},{identifier:"imgly_sticker_shapes_badge_15",defaultName:"Badge 8",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_15.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_15.png"],width:1618,height:2e3},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_15.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_15.png"],width:1618,height:2e3}}},{identifier:"imgly_sticker_shapes_badge_18",defaultName:"Badge 9",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_18.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_18.png"],width:1198,height:2e3},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_18.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_18.png"],width:1198,height:2e3}}},{identifier:"imgly_sticker_shapes_badge_19",defaultName:"Badge 10",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_19.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_19.png"],width:2127,height:481},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_19.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_19.png"],width:2127,height:481}}},{identifier:"imgly_sticker_shapes_badge_20",defaultName:"Badge 11",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_20.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_20.png"],width:2e3,height:1404},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_20.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_20.png"],width:2e3,height:1404}}},{identifier:"imgly_sticker_shapes_badge_28",defaultName:"Badge 12",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_28.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_28.png"],width:2e3,height:2e3},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_28.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_28.png"],width:2e3,height:2e3}}},{identifier:"imgly_sticker_shapes_badge_32",defaultName:"Badge 13",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_32.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_32.png"],width:1960,height:2e3},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_32.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_32.png"],width:1960,height:2e3}}},{identifier:"imgly_sticker_shapes_badge_35",defaultName:"Badge 14",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_35.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_35.png"],width:2e3,height:2002},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_35.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_35.png"],width:2e3,height:2002}}},{identifier:"imgly_sticker_shapes_badge_36",defaultName:"Badge 15",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_36.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_36.png"],width:2e3,height:1668},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_36.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_36.png"],width:2e3,height:1668}}},{identifier:"imgly_sticker_shapes_spray_01",defaultName:"Spray 1",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_spray_01.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_spray_01.png"],width:1912,height:2039},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_spray_01.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_spray_01.png"],width:1912,height:2039}}},{identifier:"imgly_sticker_shapes_spray_03",defaultName:"Spray 2",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_spray_03.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_spray_03.png"],width:1681,height:1779},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_spray_03.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_spray_03.png"],width:1681,height:1779}}},{identifier:"imgly_sticker_shapes_spray_04",defaultName:"Spray 3",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_spray_04.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_spray_04.png"],width:1407,height:2248},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_spray_04.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_spray_04.png"],width:1407,height:2248}}}]}]}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{!i&&s.return&&s.return()}finally{if(r)throw o}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.default={load:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{cors:!0,value:"anonymous"};return(e.substr(0,5),Promise.resolve([e,e])).then(function(e){var r=i(e,2),o=r[0],a=r[1];return t._createAndLoadImage(o,a,n)})},_createAndLoadImage:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{cors:!0,value:"anonymous"};return new Promise(function(e,r){var o=new Promise(function(e,n){var r=new window.Image;r.addEventListener("load",function(){e(r)}),r.addEventListener("error",function(){n(new Error("Failed to load image at "+t))}),i.cors&&(r.crossOrigin=i.value),r.src=t}),a=new Promise(function(e,r){n._loadAsDataURL(t,i).then(function(t){var n=new window.Image;n.addEventListener("load",function(){e(n)}),n.src=t,n.rawSource=t}).catch(function(t){o.then(function(t){return e(t)})})});return n._stringEndsWith(t,".svg")?o.then(function(t){return e(t)}):a.then(function(t){return e(t)})})},_stringEndsWith:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length;return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t},_loadAsDataURL:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{cors:!0,value:"anonymus"};return new Promise(function(n,i){var r=new XMLHttpRequest;r.onload=function(){var e=new FileReader;e.onloadend=function(){e.error&&i(e.error),n(e.result)},e.readAsDataURL(r.response)},r.open("GET",e),r.responseType="blob",r.withCredentials=t.cors&&"use-credentials"===t.value,r.send()})},loadXHR:function(e,t){return new Promise(function(n,i){var r=void 0;window.XDomainRequest?(r=new window.XDomainRequest,t&&r.overrideMimeType(t),r.onload=function(){n(r)},r.onerror=function(e){i(e)}):window.XMLHttpRequest&&(r=new window.XMLHttpRequest,t&&r.overrideMimeType(t),r.onreadystatechange=function(e){4===r.readyState&&(200===r.status?n(r):i(new Error("HTTP Status "+r.status)))}),r.open("GET",e,!0),r.send()})}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._bindAll("_onClick"),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"_onClick",value:function(e){this.props.onClick&&this.props.onClick()}},{key:"_renderContent",value:function(){return null}},{key:"renderWithBEM",value:function(){var e="$e:row m:"+this._modifier;return this.props.totalRows&&(e+=" m:row-"+this.props.totalRows),r.ReactBEM.createElement("bem",{specifier:"b:splashScreen"},r.ReactBEM.createElement("div",{bem:e},this._renderContent()))}}]),t}();t.default=o,o.propTypes={onClick:r.PropTypes.func},o.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(99)),a=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._bindAll("_onNewFiles"),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"componentDidMount",value:function(){this._fileLoader=new o.default(this.refs.fileInput),this._fileLoader.on("files",this._onNewFiles)}},{key:"componentWillUnmount",value:function(){this._fileLoader.off("files",this._onNewFiles),this._fileLoader.dispose(),this._fileLoader=null}},{key:"_onNewFiles",value:function(e){this.props.onNewFile&&this.props.onNewFile(e[0])}},{key:"open",value:function(){this._fileLoader.open()}},{key:"renderWithBEM",value:function(){return r.ReactBEM.createElement("input",{type:"file",accept:"image/*",bem:"b:hiddenFileInput",ref:"fileInput"})}}]),t}();t.default=a,a.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"renderWithBEM",value:function(){var e="$e:button";this.props.style&&(e+=" m:"+this.props.style),this.props.icon&&(e+=" m:withIcon");var t=null;return this.props.icon&&(t=r.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath(this.props.icon,!0)})),r.ReactBEM.createElement("bem",{specifier:"$b:topBar"},r.ReactBEM.createElement("div",{bem:e,onClick:this.props.onClick},t,r.ReactBEM.createElement("div",{bem:"e:label"},this.props.label||"Button")))}}]),t}();t.default=o,o.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._ui=t,this._options=n,this._categoriesById={},this._filtersByIdentifier={identity:r.SDK.Operations.FilterOperation.Filters.IdentityFilter},this._categories=r.Utils.wrapFiltersInCategories(r.SharedConstants.DEFAULTS.FILTERS.slice(0),e.CATEGORY_ITEMS_PROPERTY),this._options.categories&&(this._options.categories=r.Utils.wrapFiltersInCategories(this._options.categories,e.CATEGORY_ITEMS_PROPERTY)),this._initCategories()}return i(e,[{key:"instantiateFilterWithIdentifier",value:function(e){var t=this,n=this.getFilterByIdentifier(e);if(!n)return Promise.reject(new Error("Unknown filter with identifier `"+e+"`!"));if(n.prototype instanceof r.SDK.Operations.FilterOperation.Filter)return Promise.resolve(new n);var i=n.lutImage,o=n.resolution,a=n.horizontalTileCount,s=n.verticalTileCount,l=n.lightColor,c=n.darkColor;if(l&&c)return l=r.Color.fromHex(l),c=r.Color.fromHex(c),Promise.resolve(new r.SDK.Operations.FilterOperation.Filters.DuoToneFilter({lightColor:l,darkColor:c}));var u=void 0;return this._ui.getPreloader&&(u=this._ui.getPreloader().getAsset(i)),(u?Promise.resolve(u):r.ImageLoader.load(this._ui.getAssetPath(i))).then(function(){return r.ImageLoader.load(t._ui.getAssetPath(i)).then(function(e){return new r.SDK.Operations.FilterOperation.Filters.ThreeDLUTFilter({image:e,resolution:o,horizontalTileCount:a,verticalTileCount:s})})})}},{key:"_initCategories",value:function(){var t=this;if(this._options.categories&&(this._options.replaceCategories?this._categories=r.Utils.wrapFiltersInCategories(this._options.categories,e.CATEGORY_ITEMS_PROPERTY):this._categories=r.Utils.mergeCategories(this._categories,this._options.categories,e.CATEGORY_ITEMS_PROPERTY)),this._options.availableFilters){var n=[];this._categories.forEach(function(e){var i=e.filters.filter(function(e){return-1!==t._options.availableFilters.indexOf(e.identifier)});i.length>0&&n.push({identifier:e.identifier,defaultName:e.defaultName,filters:i})}),this._categories=n}var i={identifier:"all",defaultName:"All",visible:!1,filters:this._categories.length<=0?[]:this._categories.map(function(e){return e.filters}).reduce(function(e,t){return e.concat(t)})};this._categories.unshift(i),this._categoriesById.all=i,this._categories.forEach(function(e){t._categoriesById[e.identifier]=e}),i.filters.forEach(function(e){t._filtersByIdentifier[e.identifier]=e})}},{key:"getFiltersForCategory",value:function(e){if(!this._categoriesById[e])throw new Error("Unknown filter category '"+e+"'");return this._categoriesById[e].filters}},{key:"getItemsByCategory",value:function(e){return this.getFiltersForCategory(e)}},{key:"getFilterByIdentifier",value:function(e){return this._filtersByIdentifier[e]}},{key:"getCategories",value:function(){return this._categories}},{key:"getCategoryByIdentifier",value:function(e){return this._categoriesById[e]}}]),e}();o.CATEGORY_ITEMS_PROPERTY="filters",t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0},o=n(0),a=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._bindAll("_onItemDragStart","_onItemDragStop","_onItemDrag","_onSpriteUpdate"),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.BaseComponent),i(t,[{key:"_getAbsoluteSpritePosition",value:function(){var e=this.context.editor.getOutputDimensions();return this.props.sprite.getPosition().clone().multiply(e)}},{key:"componentDidMount",value:function(){r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this),this.props.sprite.on("update",this._onSpriteUpdate)}},{key:"componentWillUnmount",value:function(){r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentWillUnmount",this).call(this),this.props.sprite.off("update",this._onSpriteUpdate)}},{key:"componentWillReceiveProps",value:function(e){this.props.sprite.off("update",this._onSpriteUpdate),e.sprite.on("update",this._onSpriteUpdate)}},{key:"_onSpriteUpdate",value:function(){this.forceUpdate()}},{key:"_onItemDragStart",value:function(){var e=this.props.sprite;this._initialPosition=e.getPosition(),this.props.onDragStart&&this.props.onDragStart()}},{key:"_onItemDrag",value:function(e){var t=this.props.sprite,n=this.context.editor,i=n.getOutputDimensions(),r=this._initialPosition.clone().add(e.divide(i));t.setPosition(r),n.render()}},{key:"_onItemDragStop",value:function(){this.props.onDragStop&&this.props.onDragStop()}}]),t}();t.default=a,a.contextTypes=o.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(159)),a=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),o=0;o<n;o++)i[o]=arguments[o];var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return a._value=a.props.initialValue.clone(),a._bindAll("_onButtonClick","_onValueChange","_onColorPickerOpen","_onColorPickerClose"),a._events=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},r.Constants.EVENTS.COLORPICKER_OPEN,a._onColorPickerOpen),a.state={overlayVisible:!1},a._transparentPatternCanvas=r.Utils.createTransparentPatternCanvas(),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"componentWillReceiveProps",value:function(e){e.initialValue!==this.props.initialValue&&(this._value=e.initialValue.clone(),this._renderColor())}},{key:"componentDidMount",value:function(){(function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this),this._renderColor()}},{key:"componentDidUpdate",value:function(){this._renderColor()}},{key:"_onColorPickerOpen",value:function(e){e!==this&&this.setState({overlayVisible:!1})}},{key:"_onColorPickerClose",value:function(){this.setState({overlayVisible:!1})}},{key:"_onButtonClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.state.overlayVisible||this._emitEvent(r.Constants.EVENTS.COLORPICKER_OPEN,this),this.setState({overlayVisible:!this.state.overlayVisible})}},{key:"_onValueChange",value:function(e){this._value=e,this._renderColor(),this.forceUpdate(),this.props.onChange&&this.props.onChange(e)}},{key:"_renderColor",value:function(){var e=this.refs.canvas,t=e.getContext("2d");e.width=e.offsetWidth,e.height=e.offsetHeight;var n=t.createPattern(this._transparentPatternCanvas,"repeat");t.fillStyle=n,t.fillRect(0,0,e.width,e.height),t.fillStyle=this._value.toRGBA(),t.fillRect(0,0,e.width,e.height)}},{key:"renderWithBEM",value:function(){var e=null;this.state.overlayVisible&&(e=r.ReactBEM.createElement(o.default,{initialValue:this._value,onChange:this._onValueChange,onClose:this._onColorPickerClose,alpha:this.props.alpha}));var t=this.state.overlayVisible?"is-active":null;return r.ReactBEM.createElement("bem",{specifier:"$b:controls"},r.ReactBEM.createElement("div",{bem:"$b:colorPicker",className:t,onClick:this._onButtonClick},r.ReactBEM.createElement("canvas",{bem:"e:preview",ref:"canvas"}),r.ReactBEM.createElement("div",{bem:"e:label"},this.props.label||this._t("pesdk.common.text.color")),e))}}]),t}();t.default=a,a.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=i(n(183)),s=i(n(186)),l=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._ui=t,this._fonts=n,this._loadedFonts=[]}return o(e,[{key:"setFonts",value:function(e){this._fonts=e}},{key:"needsToLoad",value:function(){for(var e=this,t=0;t<this._fonts.length;t++){var n=function(t){var n=void 0;return e._fonts[t].getVariations().forEach(function(e){n=n||e.getProvider()}),n?{v:!0}:"continue"}(t);switch(n){case"continue":continue;default:if("object"===(void 0===n?"undefined":r(n)))return n.v}}}},{key:"fontLoaded",value:function(e){var t=e.getFontFamily();return-1!==this._loadedFonts.indexOf(t)}},{key:"setFontLoaded",value:function(e){if(!this.fontLoaded(e)){var t=e.getFontFamily();this._loadedFonts.push(t)}}},{key:"load",value:function(){var e=this,t=this._fonts,n={google:new a.default(this._ui),file:new s.default(this._ui)},i=function(){for(var e in n)n[e].dispose()};t.filter(function(t){return!e.fontLoaded(t)}).forEach(function(e){e.getVariations().forEach(function(e){var t=e.getProvider();t&&n[t].add(e)})});var r=[];for(var o in n)r.push(n[o].load());return Promise.all(r).then(function(){i(),t.forEach(function(t){e.setFontLoaded(t)})}).catch(function(e){throw i(),e})}}]),e}();t.default=l},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0},a=i(n(52)),s=i(n(17)),l=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),r(t,[{key:"_serializeSticker",value:function(e,n){var i=e.getInputDimensions(!1),r=o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_serializeSticker",this).call(this,e,n);return"none"!==n.getTintMode()&&(r.options.tintColor=n.serializeOption("tintColor",!0)),r.options.dimensions=n.getDimensions().clone().divide(i.min()).toObject(),r.options.identifier=r.options.name,delete r.options.name,r}},{key:"_serializePath",value:function(e){var n=o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_serializePath",this).call(this,e),i=e.getBrush();return i.hasOption("hardness")&&(n.hardness=i.getOption("hardness")),n}},{key:"_serializeOperation",value:function(e,n){return"frame"===e.constructor.identifier?(this._serializeFrameOperation(e,n),null):"overlay"===e.constructor.identifier?(this._serializeOverlayOperation(e,n),null):o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_serializeOperation",this).call(this,e,n)}},{key:"_serializeFrameOperation",value:function(e,t){var n=t.filter(function(e){return"sprite"===e.type}),i=void 0;n.length?i=n.pop():(i={type:"sprite",options:{sprites:[]}},t.push(i)),i.options.sprites.push({type:"frame",options:this._getFrameOptions(e)})}},{key:"_serializeOverlayOperation",value:function(e,t){if(e.getIdentifier()){var n=t.filter(function(e){return"sprite"===e.type}),i=void 0;n.length?i=n.pop():(i={type:"sprite",options:{sprites:[]}},t.push(i)),i.options.sprites.push({type:"overlay",options:{identifier:e.getIdentifier(),intensity:e.getAlpha(),blendMode:s.default[e.getBlendMode()]}})}}},{key:"_getFrameOptions",value:function(e){return{identifier:e.getFrame().identifier}}},{key:"_serializeOrientationOperation",value:function(e){var n=o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_serializeOrientationOperation",this).call(this,e);return 90!==n.options.rotation&&270!==n.options.rotation||(n.options.flipHorizontally=!n.options.flipHorizontally,n.options.flipVertically=!n.options.flipVertically),n}},{key:"_serializeTransformOperation",value:function(e){var n=this._editor.operations;if(n.exists("orientation")){e=e.clone();var i=n.get("orientation");e.rotate(-i.getRotation()),i.getFlipVertically()&&(e.flip("vertical"),e.setRotation(-1*e.getRotation())),i.getFlipHorizontally()&&(e.flip("horizontal"),e.setRotation(-1*e.getRotation()))}var r=o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_serializeTransformOperation",this).call(this,e);return r.type="transform",r}},{key:"_serializeText",value:function(e,n){var i=o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_serializeText",this).call(this,e,n),r=e.getInputDimensions(!1);return i.options.fontIdentifier=n.getFontIdentifier(),i.options.maxWidth=i.options.maxWidth*r.x/r.min(),delete i.options.fontFamily,i}},{key:"_serializeFilterOperation",value:function(e){var n=o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_serializeFilterOperation",this).call(this,e);return n?(n.options.identifier=n.options.name,delete n.options.name,n):null}},{key:"_serializeRadialFocusOperation",value:function(e){var n=o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_serializeRadialFocusOperation",this).call(this,e),i=n.options.options;return i.start=i.position,delete i.position,i.end={x:i.start.x+i.radius,y:i.start.y},delete i.radius,n}}]),t}();t.default=l,l.version="2.0.0"},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0},a=n(0),s=i(n(53)),l=i(n(47)),c=i(n(189)),u=i(n(12)),f=i(n(48)),p=i(n(30)),d=i(n(23)),h=i(n(17)),_=a.SDKUtils.flipObject(h.default),m=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));o._frameManager=new l.default(o._ui,o._getOptions("frame"));var a=o._getOptions("overlay");return a&&(o._overlayManager=new c.default(o._ui,a)),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.default),r(t,[{key:"_deserializeSprite",value:function(e,n){return"frame"===n.type?this._deserializeFrame(e,n):"overlay"===n.type?this._deserializeOverlay(e,n):o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_deserializeSprite",this).call(this,e,n)}},{key:"_deserializeOperation",value:function(e){return"transform"===e.type?this._deserializeTransformOperation(e):o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_deserializeOperation",this).call(this,e)}},{key:"_deserializeOrientationOperation",value:function(e){if(this._data.meta&&"html5"!==this._data.meta.platform)return o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_deserializeOrientationOperation",this).call(this,e);var n=e.options,i=n.rotation,r=n.flipHorizontally,a=n.flipVertically,s=90===i&&!r&&!a;return s|=90===i&&r&&a,s|=270===i&&!r&&!a,(s|=270===i&&r&&a)&&(e.options.flipHorizontally=!e.options.flipHorizontally,e.options.flipVertically=!e.options.flipVertically),o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_deserializeOrientationOperation",this).call(this,e)}},{key:"_deserializeTransformOperation",value:function(e){var n=this;return o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_deserializeCropOperation",this).call(this,e).then(function(e){if(e){var t=a.SDKUtils.Array.find(n._data.operations,function(e){return"orientation"===e.type});if(t){var i=t.options,r=i.rotation,o=i.flipHorizontally,s=i.flipVertically;90!==r&&270!==r||(!o&&s||o&&!s)&&(o=!o,s=!s),e.rotate(i.rotation),o&&(e.flip("horizontal"),e.setRotation(-1*e.getRotation())),s&&(e.flip("vertical"),e.setRotation(-1*e.getRotation()))}return e}})}},{key:"_deserializeFrame",value:function(e,t){var n=this,i=t.options.identifier,r=this._frameManager.getFrameByIdentifier(i);if(!r)return a.Log.warn("Deserializer","Unknown frame `"+i+"`. Skipping frame."),Promise.resolve();var o=new f.default(this._ui,r);return o.load().then(function(){n._editor.operations.getOrCreate("frame",{frame:o.getFrame()})})}},{key:"_deserializeOverlay",value:function(e,t){var n=this,i=t.options,r=i.blendMode,o=i.intensity,s=i.identifier,l=this._overlayManager.getOverlayByIdentifier(s);if(!l)return a.Log.warn("Deserializer","Unknown overlay `"+s+"`. Skipping overlay."),Promise.resolve();var c=this._editor.getUI().getAssetPath(l.image);return d.default.load(c).then(function(e){n._editor.operations.getOrCreate("overlay",{alpha:o,identifier:s,blendMode:parseInt(_[r||l.blendMode],10),image:e})})}},{key:"_createBrushForPath",value:function(e){var n=o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_createBrushForPath",this).call(this,e);return void 0!==e.hardness&&n.hasOption("hardness")&&n.setHardness(e.hardness),n}},{key:"_deserializeSticker",value:function(e,t){var n=this,i=a.SDK.Operations.SpriteOperation,r=t.options,o=this._stickerManager.getStickerByIdentifier(r.identifier),s=u.default.getURLForSticker(o,"base");if(!o)return a.Log.warn("Deserializer","Unknown sticker `"+r.identifier+"`. Skipping sprite."),Promise.resolve();var l=e.getInputDimensions(!1);return new Promise(function(t,c){var u=new window.Image;u.addEventListener("load",function(){var n=i.StickerSprite.prototype.availableOptions.adjustments.structure,s=r.rotation,c=r.flipHorizontally,f=r.flipVertically,p={identifier:r.identifier,image:u,position:a.Vector2.fromObject(r.position),dimensions:a.Vector2.fromObject(r.dimensions).multiply(l.min()),rotation:s,flipHorizontally:c,flipVertically:f,adjustments:{}};void 0!==r.adjustments&&["brightness","contrast","saturation"].forEach(function(e){void 0!==r.adjustments[e]&&(p.adjustments[e]=r.adjustments[e]+n[e].default)}),void 0!==r.tintColor&&void 0!==o.tintMode&&(p.tintColor=a.Color.fromArray(r.tintColor),p.tintMode=o.tintMode),t(e.createSticker(p))}),u.crossOrigin=n._editor.getCrossOrigin(),u.src=n._editor.getUI().getAssetPath(s)})}},{key:"_deserializeFilterOperation",value:function(e){var t=this,n=e.options;return this._filterManager.getFilterByIdentifier(n.identifier)?this._filterManager.instantiateFilterWithIdentifier(n.identifier).then(function(e){var i=t._editor.operations.getOrCreate("filter");if(i)return i.set({identifier:n.identifier,filter:e,intensity:n.intensity}),i}):(a.Log.warn("Deserializer","Unknown filter `"+n.identifier+"`"),Promise.resolve())}},{key:"_deserializeFocusOperation",value:function(e){var n=e.options,i=n.options;if("radial"!==n.type)return o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_deserializeFocusOperation",this).call(this,e);var r=this._editor.getImage(),s=r.width/r.height,l=i.start,c=i.end,u=i.gradientRadius,f=i.blurRadius,p=a.Vector2.fromObject(c).subtract(a.Vector2.fromObject(l)).multiply(s,1).len();return Promise.resolve(this._editor.operations.getOrCreate("radial-focus",{position:a.Vector2.fromObject(l),radius:p,gradientRadius:u,blurRadius:f}))}},{key:"_deserializeText",value:function(e,t){var n=t.options,i=n.fontSize,r=n.lineHeight,o=n.fontIdentifier,s=n.alignment,l=n.rotation,c=n.maxWidth,u=n.color,f=n.backgroundColor,d=new p.default(this._ui),h=this._fontManager.getVariationByIdentifier(o);return h?d.setFonts([h.getFont()]):h=this._fontManager.getDefaultFont(),d.load().then(function(){var t=e.getInputDimensions(!1),o=c*t.min()/t.x,p=e.createText({fontSize:i,lineHeight:r,fontFamily:h.getFontFamily(),fontWeight:h.getFontWeight(),fontIdentifier:h.getIdentifier(),alignment:s,rotation:l,maxWidth:o,text:n.text,color:a.Color.fromArray(u),backgroundColor:a.Color.fromArray(f),position:a.Vector2.fromObject(n.position)});return p._edited=!0,p})}}]),t}();t.default=m,m.version="2.0.0"},function(e,t,n){e.exports=n(70)()},function(e,t,n){var i;/*!
  Copyright (c) 2017 Jed Watson.
  Licensed under the MIT License (MIT), see
  http://jedwatson.github.io/classnames
*/
/*!
  Copyright (c) 2017 Jed Watson.
  Licensed under the MIT License (MIT), see
  http://jedwatson.github.io/classnames
*/
!function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var i=arguments[t];if(i){var o=typeof i;if("string"===o||"number"===o)e.push(i);else if(Array.isArray(i)&&i.length){var a=n.apply(null,i);a&&e.push(a)}else if("object"===o)for(var s in i)r.call(i,s)&&i[s]&&e.push(s)}}return e.join(" ")}var r={}.hasOwnProperty;void 0!==e&&e.exports?(n.default=n,e.exports=n):void 0===(i=function(){return n}.apply(t,[]))||(e.exports=i)}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(){function e(t,n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._parent=t,this._type=n,this._name=i}return i(e,[{key:"element",value:function(t){return new e(this,"element",t)}},{key:"modifier",value:function(t){return new e(this,"modifier",t)}},{key:"str",get:function(){var e=this._parent?this._parent.str:"";switch(this._type){case"block":e+="pesdk-react-"+this._name;break;case"element":e+="__"+this._name;break;case"modifier":e+="--"+this._name}return e}}]),e}();t.default={block:function(e){return new r(null,"block",e)}}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e){for(var t=[],n=0;n<e.length;n++)e[n]instanceof Array?t=t.concat(r(e[n])):t.push(e[n]);return t}Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=i(n(18)),s=i(n(34)),l=i(n(35)),c={b:"block",e:"element",m:"modifier"},u={_parseBemSpecifier:function(e){return e?e.split(" ").map(function(e){var t=e.match(/^(\$)?([bem]):(.*)$/i);if(!t)throw new Error("Invalid BEM specifier: "+e);var n=void 0!==t[1];return{type:c[t[2]],name:t[3],pass:n}}):[]},_getBemInfoForNode:function(e){var t="bem"===e.type,n=t?e.props.specifier:e.props.bem;if(t&&!n)throw new Error("<bem> elements should always have a `specifier` property");var i=this._parseBemSpecifier(n);return t&&i.forEach(function(e){e.pass=!0}),{data:i,isBemNode:t}},createElement:function(e,t){for(var n=arguments.length,i=Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];return{type:e,props:t=t||{},children:i=i.filter(function(e){return null!==e&&void 0!==e})}},_isNodeBEMable:function(e){return null!==e&&"object"===(void 0===e?"undefined":o(e))&&!a.default.isValidElement(e)},_applyBEMClasses:function(e){var t=this;if(!this._isNodeBEMable(e))return e;var n=e.props.className?[e.props.className]:[],i=this._getBemInfoForNode(e),o=e.props.__bemObject,a=e.props.__bemObject;i.data.forEach(function(e){if("block"===e.type)o=l.default.block(e.name),e.pass&&(a=l.default.block(e.name)),n.push(o.str);else if("element"===e.type){if(!o)throw new Error("Tried to create an element, but no parent block has been found.");o=o.element(e.name),e.pass&&(a=a.element(e.name)),n.push(o.str)}else if("modifier"===e.type){if(!o)throw new Error("Tried to create a modifier, but no parent block has been found.");e.pass&&(a=a.modifier(e.name)),n.push(o.modifier(e.name).str)}});var c=(0,s.default)(n);return c&&(e.props.className=c),e.children=r(e.children),e.children.forEach(function(e){t._isNodeBEMable(e)&&(e.props.__bemObject=a)}),e.children=e.children.map(function(e){return t._applyBEMClasses(e)}),e.children=r(e.children),delete e.props.__bemObject,delete e.props.bem,i.isBemNode&&(e=e.children instanceof Array&&1===e.children.length?e.children[0]:e.children),e},_transformToReact:function(e){var t=this;return this._isNodeBEMable(e)?(e.children=e.children.map(function(e){return t._transformToReact(e)}),a.default.createElement.apply(a.default,[e.type,e.props].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(e.children)))):e},transform:function(e){return(e=this._applyBEMClasses(e))instanceof Array?e:e=this._transformToReact(e)}};t.default=u},function(e,t,n){(function(t){(function(){var n,i,r;"undefined"!=typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:void 0!==t&&null!==t&&t.hrtime?(e.exports=function(){return(n()-r)/1e6},i=t.hrtime,r=(n=function(){var e;return 1e9*(e=i())[0]+e[1]})()):Date.now?(e.exports=function(){return Date.now()-r},r=Date.now()):(e.exports=function(){return(new Date).getTime()-r},r=(new Date).getTime())}).call(this)}).call(t,n(20))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._bindAll("_onClick"),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"_onClick",value:function(){this.props.onClick&&this.props.onClick(this.props.searchSuggestion)}},{key:"renderWithBEM",value:function(){var e=this.props.searchSuggestion,t={backgroundImage:"url("+e.coverImage+")"};return r.ReactBEM.createElement("bem",{specifier:"b:photoRoll e:libraryList"},r.ReactBEM.createElement("li",{bem:"e:item",style:t,onClick:this._onClick},r.ReactBEM.createElement("div",{bem:"e:overlay"}),r.ReactBEM.createElement("div",{bem:"e:name"},e.query)))}}]),t}();t.default=o,o.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(1)),s=i(n(110)),l=i(n(2)),c=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._needsStyleFixes=!0,o._totalPhotosHeight=0,o.state={loading:!1,photos:[]},o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.BaseComponent),r(t,[{key:"componentDidMount",value:function(){(function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this),this._loadPhotos()}},{key:"componentDidUpdate",value:function(){this.refs.scrollbar&&this.refs.scrollbar.update()}},{key:"_onPhotoClicked",value:function(e){this.props.onPhotoClicked&&this.props.onPhotoClicked(e)}},{key:"_getHeadline",value:function(){return this.props.library.name}},{key:"fixStyles",value:function(){if(o.Utils.Browser.isIElte(11)){var e=this.refs.cell,t=this.refs.scrollbar.getList();if(!e||!t)return;var n=e.offsetHeight;t.style.height=n+"px"}this.refs.scrollbar&&this.refs.scrollbar.update()}},{key:"_renderColumns",value:function(){for(var e=this,t=this.state.photos,n=[],i=[],r=0;r<3;r++)i.push([]),n.push(0);return t.forEach(function(t){if(t){for(var r=t.dimensions,a=null,l=1/0,c=0;c<3;c++)n[c]<=l&&(a=c,l=n[c]);i[a].push(o.ReactBEM.createElement(s.default,{photo:t.obj,onClick:e._onPhotoClicked.bind(e,t.obj)})),n[a]+=r.y}}),i}},{key:"_renderPhotos",value:function(){var e=this._renderColumns();return o.ReactBEM.createElement("div",{bem:"$b:photoRoll e:row m:fullHeight"},o.ReactBEM.createElement("div",{bem:"e:cell",ref:"cell"},o.ReactBEM.createElement(l.default,{direction:"vertical",ref:"scrollbar"},o.ReactBEM.createElement("div",{bem:"e:container",ref:"container"},o.ReactBEM.createElement("div",{bem:"e:innerContainer"},o.ReactBEM.createElement("div",{bem:"e:headline"},this._getHeadline()),o.ReactBEM.createElement("bem",{specifier:"e:photoList"},e.map(function(e){return o.ReactBEM.createElement("ul",{bem:"$e:list"},e)})))))))}},{key:"_loadPhotos",value:function(){var e=this;this._totalPhotosHeight=0;var t=a.default.instance.displayProgress(this._t("pesdk.common.text.loading"));(new(0,this.context.options.photoRoll.provider)).getPhotosForLibrary(this.props.library).then(function(n){return e._preloadPhotos(n,t)}).then(function(n){e.setState({photos:n,loading:!1}),t.close()}).catch(function(n){t.close(),a.default.instance.displayError(e._t("pesdk.library.title.photoRollLoadFail"),e._t("pesdk.library.text.photoRollLoadFail",{error:n.message}))})}},{key:"_preloadPhotos",value:function(e,t){var n=this,i=e.length,r=0,a=e.map(function(e){return n._preloadPhoto(e).then(function(a){var s=new o.Vector2(a.width,a.height);return s.multiply(240/a.width),n._totalPhotosHeight+=s.y,r++,t.setData({progress:r/i}),{obj:e,dimensions:s}}).catch(function(){})});return Promise.all(a)}},{key:"_preloadPhoto",value:function(e){var t=this;return new Promise(function(n,i){var r=new window.Image;r.addEventListener("load",function(){return n(r)}),r.addEventListener("error",function(){return i(r)}),r.crossOrigin=t.props.crossOrigin||"anonymous",r.src=e.urls.thumb})}},{key:"renderWithBEM",value:function(){return this.state.loading?o.ReactBEM.createElement("div",null):this._renderPhotos()}}]),t}();t.default=c,c.contextTypes=o.BaseComponent.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(3)),s=i(n(2)),l=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._hasBackButton=!1,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),r(t,[{key:"_onItemClick",value:function(e){this.props.onSwitchControls(e)}},{key:"_renderListItems",value:function(){var e=this,t=this.context.editor,n=[],i=function(n){var i=t.controls.get(n);return o.ReactBEM.createElement("li",{bem:"e:item",key:i.identifier,"data-identifier":i.identifier,onClick:e._onItemClick.bind(e,i)},o.ReactBEM.createElement("bem",{specifier:"$b:controls"},o.ReactBEM.createElement("div",{bem:"$e:button m:withLabel"},o.ReactBEM.createElement("img",{bem:"e:icon",src:e._getAssetPath(i.iconPath,!0)}),o.ReactBEM.createElement("div",{bem:"e:label"},e._t(i.languageKey)))))};this.context.options.editor.controlsOrder.forEach(function(e){if(Array.isArray(e)){var r=[];e.forEach(function(e){t.controls.isEnabled(e)&&r.push(i(e))}),r.length&&n.push(r)}else{var o=e;if(!t.controls.isEnabled(o))return;n.push(i(o))}});var r=[];return n.forEach(function(e){r=r.concat(e),e!==n[n.length-1]&&r.push(o.ReactBEM.createElement("li",{bem:"e:separator"}))}),r}},{key:"renderControls",value:function(){var e=this._renderListItems();return o.ReactBEM.createElement("div",{bem:"e:cell m:list"},o.ReactBEM.createElement(s.default,null,o.ReactBEM.createElement("ul",{bem:"$e:list"},e)))}}]),t}();t.default=l,l.contextTypes=a.default.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(127)),s=i(n(129)),l=i(n(130)),c=i(n(131)),u=i(n(175)),f=i(n(176)),p=i(n(177)),d=i(n(44)),h=function(e){function t(e,n,i){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return o._ui=e,o._options=n,o._mediator=i,o._ready=!1,o._padding=[0,0,0,0],o._shallow=r,r||(o._initSDK(),o._onZoom=o._onZoom.bind(o),o._onUndo=o._onUndo.bind(o),o.history=new p.default(o,o._sdk,o._mediator),o.history.on("undo",o._onUndo),o.zoom=new f.default(o,o._sdk,o._mediator),o.zoom.on("set",o._onZoom),o._initSerializers()),o._dynamicAssetsLibrary=new d.default,o.operations=new l.default(o,o._sdk,o._mediator),o.controls=new c.default(o,o._sdk,o._mediator),o.features=new u.default(o,o._sdk,o._mediator),o._running=!1,o._renderRequested=!0,o._renderCallbacks=[],o._animationFrameRequest=null,o.render=o.render.bind(o),o._tick=o._tick.bind(o),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.EventEmitter),r(t,[{key:"setImage",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._options.editor.image,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this._sdk.getRenderer(),r=new o.Vector2(t.naturalWidth||t.width,t.naturalHeight||t.height),a=1e6*this.getMaxMegapixels(),l=i.getMaxDimensions();n&&this.reset();var c=new s.default(t,a,l),u=null,f=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r;arguments.length>2&&void 0!==arguments[2]&&arguments[2],e._setImage(t,u,n),e._initWatermark(),e._ready=!0,e.emit("ready")};c.needsResize()?(this.emit("resize"),u=this._sdk.parseExif(t),c.resize().then(function(t){var n=t.canvas,i=t.dimensions,r=t.reason;n.src="data:image/jpeg;base64,",e.emit("resized",{dimensions:i,reason:r}),f(n,i,r)})):f(t)}},{key:"_initWatermark",value:function(){this._options.editor.watermarkImage&&(this._watermarkOperation=this.operations.getOrCreate("watermark",{image:this._options.editor.watermarkImage}))}},{key:"_initSDK",value:function(){var e=this._options,t=e.logLevel,n=e.displayWelcomeMessage,i=e.debug,r=e.license,a=e.crossOrigin,s=this._options.editor,l=s.smoothDownscaling,c=s.smoothUpscaling,u=s.preferredRenderer,f={logLevel:t,debug:i,displayWelcomeMessage:n,pixelRatio:s.pixelRatio,smoothDownscaling:l,smoothUpscaling:c,crossOrigin:a,transparent:!0,license:r};this._sdk=new o.SDK(u,f)}},{key:"_onZoom",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.fixOffset(),this.render(function(){t._mediator.emit(o.Constants.EVENTS.ZOOM_DONE),n&&n()})}},{key:"_onUndo",value:function(){this.render()}},{key:"getRotation",value:function(){return this._sdk.getRotation()}},{key:"setRotation",value:function(e){this._sdk.setRotation(e)}},{key:"getSpriteScale",value:function(){return this._sdk.getSpriteScale()}},{key:"setSpriteScale",value:function(e){this._sdk.setSpriteScale(e)}},{key:"getCrossOrigin",value:function(){return o.SDKUtils.getCrossOriginValue(this._options.crossOrigin||"anonymous")}},{key:"isToolAllowed",value:function(e){return!!this._shallow||this._sdk._l.isToolAllowed(e)}},{key:"isToolEnabled",value:function(e){return-1!==this._options.editor.tools.indexOf(e)}},{key:"getMaxMegapixels",value:function(){var e=this._options.editor.maxMegaPixels;return o.Utils.isMobile()?e.mobile:e.desktop}},{key:"getOutputDimensions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._sdk.getOutputDimensions(e)}},{key:"getOutputTextureDimensions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._sdk.getOutputTextureDimensions(e)}},{key:"getFinalDimensions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._sdk.getFinalDimensions(e)}},{key:"getCanvasDimensions",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this._sdk.getCanvas(),n=new o.Vector2(t.offsetWidth,t.offsetHeight);return e&&n.subtract(this._padding[1]+this._padding[3],this._padding[0]+this._padding[2]),n}},{key:"_setImage",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._options.editor.image,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this._sdk.setAllOperationsToDirty(),this._options.editor.image=e,this._sdk.setImage(e,t,n),this.zoom.set("auto"),this.emit("new-image")}},{key:"export",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._watermarkOperation&&this._watermarkOperation.setEnabled(!1),this._sdk.setAllOperationsToDirty();var n=this._options.editor.export;return new a.default(this._sdk,n,t).export().then(function(t){return e.emit("export",t),e._mediator.emit(o.Constants.EVENTS.EXPORT,t,e),e._watermarkOperation&&(e._watermarkOperation.setEnabled(!0),e._sdk.render()),e._sdk.setAllOperationsToDirty(),t})}},{key:"_initSerializers",value:function(){this._serializers={"1.0.0":n(178).default,"1.0.1":n(187).default,"2.0.0":n(188).default,"2.0.1":n(190).default,"3.0.0":n(193).default,"3.1.0":n(195).default,"3.2.0":n(196).default,"3.4.0":n(197).default,"3.5.0":n(199).default,"3.6.0":n(200).default,"3.7.0":n(201).default}}},{key:"serialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"3.7.0",n=this._serializers[t];return n?new n(this).serialize(e):o.Promise.reject(new Error("No serializer for version "+t+" found."))}},{key:"deserialize",value:function(e){var t=this,n=this._serializers[e.version];return n?new n(this).deserialize(e).then(function(){t.zoom.set("auto")}):o.Promise.reject(new Error("No serializer for version "+e.version+" found."))}},{key:"_applyOffset",value:function(){var e=this._offset.clone();e.x-=this._padding[1]/2,e.x+=this._padding[3]/2,e.y-=this._padding[2]/2,e.y+=this._padding[0]/2,this._sdk.setOffset(e)}},{key:"start",value:function(){this.zoom.set("auto"),this._animationFrameRequest=(0,o.requestAnimationFrame)(this._tick)}},{key:"stop",value:function(){this._running=!1,this._animationFrameRequest&&((0,o.cancelAnimationFrame)(this._animationFrameRequest),this._renderCallbacks=[])}},{key:"render",value:function(e){this._renderRequested=!0,e&&this._renderCallbacks.push(e)}},{key:"setOffset",value:function(e){this._offset=this._clampOffset(e)}},{key:"getOffset",value:function(){return this._offset}},{key:"fixOffset",value:function(){this.setOffset(this._sdk.getOffset())}},{key:"_clampOffset",value:function(e){var t=this._sdk.getRenderer(),n=new o.Vector2(t.getWidth(),t.getHeight()),i=this._sdk.getOutputDimensions(!1),r=n.clone().subtract(i).divide(2).clamp(null,new o.Vector2(0,0)),a=i.clone().subtract(n).divide(2).clamp(new o.Vector2(0,0),null);return e.clone().clamp(r,a).round()}},{key:"_tick",value:function(){var e=this;if(this._renderRequested){var t=this._renderCallbacks.slice(0);this._renderCallbacks=[],this._render().then(function(){t.forEach(function(e){return e()}),e._animationFrameRequest=(0,o.requestAnimationFrame)(e._tick)}).catch(function(e){o.Log.error("An error occurred while rendering: "+e.message)}),this._renderRequested=!1}else this._animationFrameRequest=(0,o.requestAnimationFrame)(this._tick)}},{key:"_render",value:function(){var e=this;return this._ready?(this._applyOffset(),this._sdk.render().then(function(){e._lastOutputBounds=e._sdk.getSprite().getBounds()}).catch(function(t){e.emit("render-error",t)})):o.Promise.resolve()}},{key:"reset",value:function(){this._sdk.reset(),this.history.reset(),this.operations.reset()}},{key:"dispose",value:function(){this.stop(),this._sdk.dispose()}},{key:"isReady",value:function(){return this._ready}},{key:"getRenderer",value:function(){return this._sdk.getRenderer()}},{key:"getSDK",value:function(){return this._sdk}},{key:"getInputDimensions",value:function(){return this._sdk.getInputDimensions(!1)}},{key:"getPadding",value:function(){return this._padding}},{key:"setPadding",value:function(e){this._padding=e||[0,0,0,0]}},{key:"getImage",value:function(){return this._options.editor.image}},{key:"getOptions",value:function(){return this._options}},{key:"getUI",value:function(){return this._ui}},{key:"getMediator",value:function(){return this._mediator}},{key:"getDynamicAssetsLibrary",value:function(){return this._dynamicAssetsLibrary}},{key:"broadcastTransform",value:function(e,t){var n=this,i=new o.SDK.Operations.TransformOperation.TransformChange(e,t);["sprite","selective-blur","radial-focus","mirrored-focus","linear-focus","blur"].forEach(function(e){var t=n.operations.get(e);t&&t.transform(i)})}},{key:"broadcastFlip",value:function(e){var t=this;["mirrored-focus","radial-focus","linear-focus","sprite","selective-blur"].forEach(function(n){var i=t.operations.get(n);i&&i.flip(e)})}},{key:"broadcastRotate",value:function(e){var t=this;["transform","mirrored-focus","radial-focus","linear-focus","sprite","selective-blur"].forEach(function(n){var i=t.operations.get(n);i&&i.rotate(e)})}}]),t}();t.default=h},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(132);Object.defineProperty(t,"adjustments",{enumerable:!0,get:function(){return i(r).default}});var o=n(135);Object.defineProperty(t,"transform",{enumerable:!0,get:function(){return i(o).default}});var a=n(139);Object.defineProperty(t,"filter",{enumerable:!0,get:function(){return i(a).default}});var s=n(142);Object.defineProperty(t,"focus",{enumerable:!0,get:function(){return i(s).default}});var l=n(147);Object.defineProperty(t,"sticker",{enumerable:!0,get:function(){return i(l).default}});var c=n(155);Object.defineProperty(t,"text",{enumerable:!0,get:function(){return i(c).default}});var u=n(165);Object.defineProperty(t,"brush",{enumerable:!0,get:function(){return i(u).default}});var f=n(169);Object.defineProperty(t,"selectiveBlur",{enumerable:!0,get:function(){return i(f).default}});var p=n(172);Object.defineProperty(t,"frame",{enumerable:!0,get:function(){return i(p).default}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(141)),a=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e._bindAll("_onButtonClick"),e.state={overlayVisible:!1},e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"_onButtonClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.setState({overlayVisible:!this.state.overlayVisible})}},{key:"renderWithBEM",value:function(){var e=null;this.state.overlayVisible&&(e=r.ReactBEM.createElement(o.default,{items:this.props.items,selectedItem:this.props.selectedItem,onChange:this.props.onChange}));var t=this.state.overlayVisible?"is-active":null;return r.ReactBEM.createElement("bem",{specifier:"$b:controls"},r.ReactBEM.createElement("div",{bem:"$e:categoryDropdown",className:t,onClick:this._onButtonClick},r.ReactBEM.createElement("img",{bem:"e:icon",src:this.props.selectedItem.icon}),r.ReactBEM.createElement("div",{bem:"e:label"},this.props.selectedItem.label),e))}}]),t}();t.default=a,a.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._assetsByGroupId={}}return i(e,[{key:"addAsset",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this._assetsByGroupId[e]?n?this._assetsByGroupId[e].unshift(t):this._assetsByGroupId[e].push(t):this._assetsByGroupId[e]=[t]}},{key:"setAssets",value:function(e,t){this._assetsByGroupId[e]=t}},{key:"getAssets",value:function(e){return this._assetsByGroupId[e]=this._assetsByGroupId[e]||[],this._assetsByGroupId[e]}}]),e}();t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"componentDidMount",value:function(){(function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this),this._renderCanvas()}},{key:"componentDidUpdate",value:function(){this._renderCanvas()}},{key:"_renderCanvas",value:function(){var e=this.refs.canvas,t=this.context.editor.getSDK().getPixelRatio();e.width=e.offsetWidth*t,e.height=e.offsetHeight*t,e.style.width=e.offsetWidth+"px",e.style.height=e.offsetHeight+"px";var n=e.getContext("2d");n.fillStyle="red",n.clearRect(0,0,e.width,e.height),n.font=(this.props.fontStyle||"")+" "+(this.props.fontWeight||"")+" "+24*t+"px "+this.props.fontFamily,n.textBaseline="middle",n.textAlign="center",n.fillStyle="white",n.fillText("Abc",e.width/2,e.height/2)}},{key:"renderWithBEM",value:function(){return r.ReactBEM.createElement("canvas",{bem:"b:fontFamily e:canvas",ref:"canvas"})}}]),t}();t.default=o,o.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(5),o={100:"Extra Light",200:"Light",300:"Book",400:"Regular",500:"Medium",600:"Semibold",700:"Bold",800:"Black",900:"Extra Black",bold:"Bold",normal:"Regular"},a=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.Configurable),i(t,[{key:"getLabel",value:function(){var e=o[this._options.fontWeight];switch(this._options.fontStyle){case"italic":e+=" Italic"}return e}}]),t}();t.default=a,a.prototype.availableOptions={identifier:{type:r.OptionType.STRING,required:!0},fontFamily:{type:r.OptionType.STRING,required:!0},fontWeight:{type:r.OptionType.ALL,default:400},fontStyle:{type:r.OptionType.STRING,default:"normal"},textMetrics:{type:r.OptionType.OBJECT,default:null},provider:{type:r.OptionType.STRING,available:["google","file"]},filePath:{type:r.OptionType.STRING},default:{type:r.OptionType.BOOLEAN,default:!1},font:{type:r.OptionType.OBJECT}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._ui=t,this._options=n,this._categoriesById={},this._categories=[],this._framesById={},this._addCategories(r.SharedConstants.DEFAULTS.FRAME_CATEGORIES);var i=this._options,o=i.categories,a=i.replaceCategories;this._options.categories?this._addCategories(o,a):this._updateAllCategory()}return i(e,[{key:"_addCategories",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._categories=n?e.slice(0):r.Utils.mergeCategories(this._categories,e,"frames"),this._categoriesById={},this._categories.forEach(function(e){t._categoriesById[e.identifier]=e});var i=this._options.availableFrames;i&&this._categories.forEach(function(e){e.frames=e.frames.filter(function(e){return-1!==i.indexOf(e.identifier)})}),this._categories.forEach(function(e){e.frames.forEach(function(e){t._framesById[e.identifier]=e})}),this._updateAllCategory()}},{key:"_updateAllCategory",value:function(){this._allCategory={identifier:"all",defaultName:"All",frames:this._categories.map(function(e){return e.frames}).reduce(function(e,t){return e.concat(t)},[])},this._categoriesById.all=this._allCategory}},{key:"getFramesForCategory",value:function(e){if(!this._categoriesById[e])throw new Error("Unknown frame category '"+e+"'");return this._categoriesById[e].frames}},{key:"getFrameByIdentifier",value:function(e){return this._framesById[e]}},{key:"getCategories",value:function(){return this._categories}},{key:"getCategory",value:function(e){return this._categoriesById[e]}}]),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=r.SDK.OptionType,a=function(e){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,n));return i._loaded=!1,i._loading=!1,i._ui=e,i._frame=r.SDK.Utils.deepClone(i._options),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.SDK.Configurable),i(t,[{key:"load",value:function(){var e=this;if(this._loaded)return Promise.resolve();if(this._loading)return Promise.reject(new Error("Called Frame#load while it's already loading"));this._loading=!0;var t=this._frame.imageGroups,n=[];return["top","left","right","bottom"].forEach(function(i){if(i in t){var r=t[i];["start","mid","end"].forEach(function(t){t in r&&n.push(e._loadPart(i,t))})}}),Promise.all(n).then(function(){e._loaded=!0,e._loading=!1}).catch(function(t){e._loaded=!1,e._loading=!1})}},{key:"_loadPart",value:function(e,t){var n=this;return new Promise(function(i,r){var o=n._frame.imageGroups[e][t],a=o;"string"!=typeof o&&"image"in o&&(a=o.image);var s=new window.Image;s.addEventListener("load",function(){"string"!=typeof o?n._frame.imageGroups[e][t].image=s:n._frame.imageGroups[e][t]=s,i(s)}),s.addEventListener("error",function(){r(new Error("Failed to load image at "+a))}),s.crossOrigin=n._ui.getEditor().getCrossOrigin(),s.src=n._ui.getAssetPath(a)})}},{key:"getFrame",value:function(){return this._frame}}]),t}();t.default=a,a.prototype.availableOptions={identifier:{type:o.STRING,required:!0},defaultName:{type:o.STRING},thumbnail:{type:o.STRING},tintable:{type:o.BOOLEAN,default:!1},layoutMode:{type:o.STRING,default:"horizontal-inside",available:["horizontal-inside","vertical-inside"]},imageGroups:{type:o.OBJECT,required:!0}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=2*Math.PI,a=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._editor=t,this._serializeOperations=this._serializeOperations.bind(this)}return i(e,[{key:"serialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._options=r.SDKUtils.defaults(e,{image:!0});var t={version:this.constructor.version};return this._serializeInputImage(t).then(this._serializeOperations)}},{key:"_serializeInputImage",value:function(e){var t=this._editor.getImage(),n=t.width,i=t.height;if(!this._options.image)return e.inputImage={width:n,height:i},Promise.resolve(e);var o=r.SDKUtils.createCanvas();o.width=t.width,o.height=t.height,o.getContext("2d").drawImage(t,0,0);var a=o.toDataURL(r.ImageFormat.PNG);return e.inputImage={type:r.ImageFormat.PNG,data:a.replace(/^data:image\/(.*?);base64,/,""),width:n,height:i},Promise.resolve(e)}},{key:"_serializeOperations",value:function(e){var t=this,n=[];return this._editor.operations.getStack().forEach(function(e){var i=t._serializeOperation(e,n);i&&n.push(i)}),e.operations=n.filter(function(e){return e}),Promise.resolve(e)}},{key:"_serializeOperation",value:function(e,t){switch(e.constructor.identifier){case"transform":return this._serializeTransformOperation(e);case"orientation":return this._serializeOrientationOperation(e);case"filter":return this._serializeFilterOperation(e);case"adjustments":return this._serializeAdjustmentsOperation(e);case"sprite":return this._serializeSpriteOperation(e,t);case"radial-focus":return this._serializeRadialFocusOperation(e);case"mirrored-focus":return this._serializeLinearFocusOperation(e);default:r.Log.warn("Unable to serialize operation of type "+e.constructor.identifier)}}},{key:"_serializeTransformOperation",value:function(e){var t=e.serializeOptions(["start","end","rotation"],!0);return t.rotation=(t.rotation+o)%o,{type:"crop",options:t}}},{key:"_serializeOrientationOperation",value:function(e){return{type:"orientation",options:e.serializeOptions(["flipVertically","flipHorizontally","rotation"],!0)}}},{key:"_serializeFilterOperation",value:function(e){return"identity"===e.getIdentifier()?null:{type:"filter",options:{intensity:e.getIntensity(),name:e.getIdentifier()}}}},{key:"_serializeAdjustmentsOperation",value:function(e){var t=e.availableOptions,n={};return["brightness","saturation","contrast","exposure","shadows","highlights","clarity"].forEach(function(i){var r=t[i],o=e.getOption(i),a=r.minValue,s=r.midValue,l=r.maxValue;n[i]=o<=s?(o-a)/(s-a)-1:(o-s)/(l-s)}),{type:"adjustments",options:n}}},{key:"_serializeSpriteOperation",value:function(e,t){var n=this,i=t.filter(function(e){return"sprite"===e.type}),r=void 0,o=!0;if(i.length?(r=i.pop(),o=!1):r={type:"sprite",options:{sprites:[]}},e.getSprites().forEach(function(t){var i=null;t instanceof e.constructor.StickerSprite?i=n._serializeSticker(e,t):t instanceof e.constructor.TextSprite?i=n._serializeText(e,t):t instanceof e.constructor.BrushSprite?i=n._serializeBrush(e,t):t instanceof e.constructor.TextDesignSprite&&(i=n._serializeTextDesign&&n._serializeTextDesign(e,t)),i&&r.options.sprites.push(i)}),o)return r}},{key:"_serializeSticker",value:function(e,t){var n=t.getAdjustments(),i=t.serializeOptions(["identifier","position","dimensions","flipVertically","flipHorizontally","rotation"],!0);i.name=i.identifier,delete i.identifier,i.rotation=(i.rotation+o)%o;var r=n.availableOptions;return i.adjustments={brightness:n.getBrightness()-r.brightness.default,saturation:n.getSaturation()-r.saturation.default,contrast:n.getContrast()-r.contrast.default},{type:"sticker",options:i}}},{key:"_serializeText",value:function(e,t){var n=t.serializeOptions(["fontSize","lineHeight","fontFamily","fontWeight","alignment","color","backgroundColor","position","rotation","text","maxWidth"],!0);return n.rotation=(n.rotation+o)%o,{type:"text",options:n}}},{key:"_serializeBrush",value:function(e,t){var n=this;return{type:"brush",options:{paths:t.getPaths().map(function(e){return n._serializePath(e)})}}}},{key:"_serializePath",value:function(e){var t=e.getBrush().serializeOptions(["color","size"],!0);return t.points=e.getControlPoints().map(function(e){return e.getPosition().toObject()}),t}},{key:"_serializeRadialFocusOperation",value:function(e){return{type:"focus",options:{type:"radial",options:e.serializeOptions(["position","radius","gradientRadius","blurRadius"],!0)}}}},{key:"_serializeLinearFocusOperation",value:function(e){return{type:"focus",options:{type:"linear",options:e.serializeOptions(["start","end","blurRadius","size","gradientSize"],!0)}}}},{key:"_getInputDimensionsForOperation",value:function(e){var t=!1,n=this._editor.getInputDimensions();return this._editor.operations.getStack().forEach(function(i){i===e&&(t=!0),t||(n=i.getNewDimensions(n))}),n}}]),e}();t.default=a,a.version="1.0.0"},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=i(n(179)),a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=n(0),l=i(n(27)),c=i(n(12)),u=i(n(182)),f=i(n(9)),p=i(n(30)),d=void 0;void 0!==s.SDK.Operations.SpriteOperation&&(d=s.SDK.Operations.SpriteOperation.BrushSprite);var h=function(){function e(t,n){r(this,e),this._editor=t,this._ui=this._editor.getUI(),this._data=n,this._filterManager=new l.default(this._ui,this._getOptions("filter")),this._stickerManager=new c.default(this._ui,this._getOptions("sticker")),this._brushManager=new u.default(this._ui,this._getOptions("brush")),this._fontManager=new f.default(this._ui,this._getOptions("text"))}return a(e,[{key:"_getOptions",value:function(e){var t=this._editor.controls,n={};t&&t.get(e)&&(n=t.get(e).defaultOptions);var i=this._editor.getOptions();return s.SDKUtils.deepDefaults({},i.editor.controlsOptions[e]||{},n)}},{key:"deserialize",value:function(){var e=this;return this._validateVersion().then(function(){return e._deserializeInputImage()}).then(function(){return e._deserializeOperations()})}},{key:"_validateVersion",value:function(){return this._data.version!==this.constructor.version?Promise.reject(new Error("Invalid version "+this._data.version+", expected "+this.constructor.version)):Promise.resolve()}},{key:"_deserializeInputImage",value:function(){var e=this;return new Promise(function(t,n){var i=e._data.inputImage,r=i.data,o=i.type;if(r&&o){var a=new window.Image;a.addEventListener("load",function(){e._editor.setImage(a),t()}),a.src="data:"+o+";base64,"+r}else t()})}},{key:"_deserializeOperations",value:function(){var e=function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){return function i(r,o){try{var a=t[r](o),s=a.value}catch(e){return void n(e)}if(!a.done)return Promise.resolve(s).then(function(e){i("next",e)},function(e){i("throw",e)});e(s)}("next")})}}(o.default.mark(function e(){var t,n,i,r,a;return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=this._data.operations,n=[],i=0;case 3:if(!(i<t.length)){e.next=12;break}return r=t[i],e.next=7,this._deserializeOperation(r);case 7:a=e.sent,n.push(a);case 9:i++,e.next=3;break;case 12:return e.abrupt("return",n);case 13:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"_deserializeOperation",value:function(e){switch(e.type){case"crop":return this._deserializeCropOperation(e);case"orientation":return this._deserializeOrientationOperation(e);case"filter":return this._deserializeFilterOperation(e);case"adjustments":return this._deserializeAdjustmentsOperation(e);case"sprite":return this._deserializeSpriteOperation(e);case"focus":return this._deserializeFocusOperation(e)}}},{key:"_deserializeCropOperation",value:function(e){var t=e.options,n=t.rotation,i=s.Vector2.fromObject(t.start),r=s.Vector2.fromObject(t.end);n>Math.PI&&(n-=2*Math.PI);var o={start:i,end:r};void 0!==n&&(o.rotation=n);var a=this._editor.operations.getOrCreate("transform");return this._editor.broadcastTransform(a,o),a.set(o),Promise.resolve(a)}},{key:"_deserializeOrientationOperation",value:function(e){var t=e.options,n=this._editor.operations.getOrCreate("orientation");return n?(n.set(t),Promise.resolve(n)):Promise.resolve()}},{key:"_deserializeFilterOperation",value:function(e){var t=this,n=e.options;return this._filterManager.getFilterByIdentifier(n.name)?this._filterManager.instantiateFilterWithIdentifier(n.name).then(function(e){var i=t._editor.operations.getOrCreate("filter");return i.set({identifier:n.name,filter:e,intensity:n.intensity}),i}):(s.Log.warn("Deserializer","Unknown filter `"+n.name+"`"),Promise.resolve())}},{key:"_deserializeAdjustmentsOperation",value:function(e){var t=s.SDK.Operations.AdjustmentsOperation,n=e.options,i={};return["brightness","saturation","contrast","exposure","shadows","highlights","clarity"].forEach(function(e){if(void 0!==n[e]){var r=t.prototype.availableOptions[e],o=r.minValue,a=r.midValue,s=r.maxValue,l=n[e];l=l<0?a+(a-o)*l:a+(s-a)*l,i[e]=l}}),Promise.resolve(this._editor.operations.getOrCreate("adjustments",i))}},{key:"_deserializeSpriteOperation",value:function(e){var t=this,n=e.options,i=this._editor.operations.getOrCreate("sprite");if(!i)return Promise.resolve();var r=n.sprites.map(function(e){return t._deserializeSprite(i,e)}).filter(function(e){return e});return Promise.all(r).then(function(e){return i.setSprites(e.filter(function(e){return e})),i})}},{key:"_deserializeSprite",value:function(e,t){switch(t.type){case"sticker":return this._deserializeSticker(e,t);case"text":return this._deserializeText(e,t);case"brush":return this._deserializeBrush(e,t);case"textdesign":return this._deserializeTextDesign&&this._deserializeTextDesign(e,t)}}},{key:"_deserializeSticker",value:function(e,t){var n=this,i=s.SDK.Operations.SpriteOperation,r=t.options,o=this._stickerManager.getStickerByIdentifier(r.name),a=this._stickerManager.getURLForSticker(o);return o?new Promise(function(t,o){var l=new window.Image;l.addEventListener("load",function(){var n=i.StickerSprite.prototype.availableOptions.adjustments.structure,o=r.rotation,a=r.flipHorizontally,c=r.flipVertically,u={identifier:r.name,image:l,position:s.Vector2.fromObject(r.position),dimensions:s.Vector2.fromObject(r.dimensions),rotation:o,flipHorizontally:a,flipVertically:c,adjustments:{}};void 0!==r.adjustments&&["brightness","contrast","saturation"].forEach(function(e){void 0!==r.adjustments[e]&&(u.adjustments[e]=r.adjustments[e]+n[e].default)}),t(e.createSticker(u))}),l.crossOrigin=n._editor.getCrossOrigin(),l.src=n._editor.getUI().getAssetPath(a)}):(s.Log.warn("Deserializer","Unknown sticker '"+r.name+"'. Skipping sprite."),Promise.resolve())}},{key:"_deserializeText",value:function(e,t){var n=t.options,i=n.fontSize,r=n.lineHeight,o=n.fontFamily,a=n.fontWeight,l=n.alignment,c=n.rotation,u=n.maxWidth,f=n.color,d=n.backgroundColor,h=new p.default(this._ui),_=this._fontManager.getFontByFontFamily(o);return _||(_=this._fontManager.getDefaultFont()),h.setFonts([_]),h.load().then(function(){var t=e.createText({fontSize:i,lineHeight:r,fontFamily:o,fontWeight:a,alignment:l,rotation:c,maxWidth:u,text:n.text,color:s.Color.fromArray(f),backgroundColor:s.Color.fromArray(d),position:s.Vector2.fromObject(n.position)});return t._edited=!0,t})}},{key:"_deserializeBrush",value:function(e,t){var n=this,i=t.options.paths,r=e.createBrush();return i.forEach(function(e){n._deserializeBrushPath(r,e)}),Promise.resolve(r)}},{key:"_deserializeBrushPath",value:function(e,t){var n=t.points,i=this._createBrushForPath(t),r=e.createPath(i);r.setClosed(!0),n.forEach(function(e){r.addControlPoint(s.Vector2.fromObject(e))})}},{key:"_createBrushForPath",value:function(e){var t=e.color,n=e.size,i={color:s.Color.fromArray(t),size:n},o=this._brushManager.getFirstBrush();if(o.prototype&&o.prototype instanceof d)return new o(i);var a=s.SDKUtils.extend({},o);delete a.image;var l=function(e){function t(){return r(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,d),t}();return l.identifier=o.identifier,new l(s.SDKUtils.extend({},a,i))}},{key:"_deserializeFocusOperation",value:function(e){var t=e.options.options;switch(e.options.type){case"radial":var n=t.position,i=t.radius,r=t.gradientRadius,o=t.blurRadius;return Promise.resolve(this._editor.operations.getOrCreate("radial-focus",{position:s.Vector2.fromObject(n),radius:i,gradientRadius:r,blurRadius:o}));case"linear":var a=t.start,l=t.end,c=t.size,u=t.gradientSize,f=t.blurRadius;return Promise.resolve(this._editor.operations.getOrCreate("mirrored-focus",{start:s.Vector2.fromObject(a),end:s.Vector2.fromObject(l),size:c,gradientSize:u,blurRadius:f}))}}},{key:"_getInputDimensionsForOperation",value:function(e){var t=!1,n=this._editor.getInputDimensions();return this._editor.operations.getStack().forEach(function(i){i===e&&(t=!0),t||(n=i.getNewDimensions(n))}),n}}]),e}();t.default=h,h.version="1.0.0"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(e){return e&&e.__esModule?e:{default:e}}(n(184)),o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._ui=t,this._fonts=[],this._observers=[]}return i(e,[{key:"add",value:function(e){this._fonts.push(e)}},{key:"load",value:function(){var e=this;return 0===this._fonts.length?Promise.resolve():(this._observers=[],this._fonts.forEach(function(t){e._observers.push(new r.default(t))}),Promise.all(this._observers.map(function(e){return e.observe()})))}},{key:"dispose",value:function(){this._observers.forEach(function(e){return e.dispose()})}}]),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(e){return e&&e.__esModule?e:{default:e}}(n(49)),o=2*Math.PI,a=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.default),i(t,[{key:"_serializeTransformOperation",value:function(e){var t=e.serializeOptions(["start","end","rotation","textureScale"],!0);return t.rotation=(t.rotation+o)%o,1!==t.textureScale&&(t.dimensions=e.getNewDimensions(e.getInputDimensions(!1))),delete t.textureScale,{type:"crop",options:t}}}]),t}();t.default=a,a.version="1.0.1"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(50)),a=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),i(t,[{key:"_deserializeOperation",value:function(e){return"selective-blur"===e.type?this._deserializeSelectiveBlurOperation(e):function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_deserializeOperation",this).call(this,e)}},{key:"_deserializeCropOperation",value:function(e){var t=e.options,n=t.rotation,i=r.Vector2.fromObject(t.start),o=r.Vector2.fromObject(t.end),a=t.dimensions?r.Vector2.fromObject(t.dimensions):null;if(o.x-i.x<=0||o.y-i.y<=0)throw new Error("A crop should not result in negative or zero dimensions - start: "+i+" - end: "+o);n>Math.PI&&(n-=2*Math.PI);var s={start:i,end:o};void 0!==n&&(s.rotation=n);var l=this._editor.operations.getOrCreate("transform");if(!l)return Promise.resolve();if(this._editor.broadcastTransform(l,s),l.set(s),a){var c=o.clone().subtract(i),u=l.getInputDimensions(!1).multiply(c);l.setTextureScale(a.x/u.x)}return Promise.resolve(l)}}]),t}();t.default=a,a.version="1.0.1"},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0},s=n(0),l=i(n(31)),c=i(n(194)),u=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l.default),o(t,[{key:"serialize",value:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"serialize",this).call(this,n).then(function(t){return t.meta={platform:"html5",version:e._editor.getSDK().version,createdAt:s.SDKUtils.ISODateString(new Date)},t.image=t.inputImage,delete t.inputImage,t})}},{key:"_serializeSticker",value:function(e,n){var i=a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_serializeSticker",this).call(this,e,n);return i.options.alpha=n.getAlpha(),i.options.tintColor&&(i.options.tintColor={rgba:i.options.tintColor}),i}},{key:"_serializeText",value:function(e,n){var i=a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_serializeText",this).call(this,e,n);return i.options.color={rgba:i.options.color},i.options.backgroundColor={rgba:i.options.backgroundColor},i.options.flipHorizontally=!1,i.options.flipVertically=!1,delete i.options.fontWeight,i}},{key:"_serializePath",value:function(e){var n=a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_serializePath",this).call(this,e);delete n.hardness,delete n.size,delete n.color;var i=e.getBrush();n.brush=i.serializeOptions(["identifier","size","color"],!0),void 0===n.brush.identifier&&delete n.brush.identifier,n.brush.color={rgba:n.brush.color};var r=i.getOption("hardness");return"undefined"!==r&&(n.brush.hardness=r),n}},{key:"_serializeFrameOperation",value:function(e,n){a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_serializeFrameOperation",this).call(this,e,n);var i=n.filter(function(e){return"sprite"===e.type});if(i.length){var r=i.pop().options.sprites.filter(function(e){return"frame"===e.type})[0];e.getTintColor().equals(new s.Color(1,1,1,0))||(r.options.tintColor={rgba:e.serializeOption("tintColor",!0)});var o=e.serializeOptions(["scale","alpha"],!0);r.options=s.SDKUtils.extend(r.options,o),r.options.size=r.options.scale,delete r.options.scale}}},{key:"_serializeTransformOperation",value:function(e){var n=a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_serializeTransformOperation",this).call(this,e);if(e._ratio){var i=void 0;i=e._ratio instanceof c.default?e._ratio.getIdentifier():e._ratio.identifier,n.options.meta={identifier:i}}return delete n.options.scale,n}},{key:"_serializeAdjustmentsOperation",value:function(e){var n=a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_serializeAdjustmentsOperation",this).call(this,e),i=e.availableOptions,o={};return["gamma","whites","blacks","temperature"].forEach(function(t){var n=i[t],r=e.getOption(t),a=n.minValue,s=n.midValue,l=n.maxValue;o[t]=r<=s?(r-a)/(s-a)-1:(r-s)/(l-s)}),n.options=r({},n.options,o),n}},{key:"_serializeOperation",value:function(e,n){switch(e.constructor.identifier){case"mirrored-focus":return this._serializeMirroredFocusOperation(e);case"linear-focus":return this._serializeLinearFocusOperation(e);case"blur":return this._serializeBlurOperation(e);default:return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_serializeOperation",this).call(this,e,n)}}},{key:"_serializeMirroredFocusOperation",value:function(e){return{type:"focus",options:{type:"mirrored",options:e.serializeOptions(["start","end","blurRadius","size","gradientSize"],!0)}}}},{key:"_serializeLinearFocusOperation",value:function(e){var t=e.serializeOptions(["controlPoint1","controlPoint2","blurRadius"],!0);return t.start=t.controlPoint1,delete t.controlPoint1,t.end=t.controlPoint2,delete t.controlPoint2,{type:"focus",options:{type:"linear",options:t}}}},{key:"_serializeBlurOperation",value:function(e){return{type:"focus",options:{type:"gaussian",options:e.serializeOptions(["blurRadius"],!0)}}}}]),t}();t.default=u,u.version="3.0.0"},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),c=function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0},u=n(0),f=i(n(32)),p=i(n(12)),d=i(n(13)),h=i(n(23)),_=i(n(9)),m=void 0;void 0!==u.SDK.Operations.SpriteOperation&&(m=u.SDK.Operations.SpriteOperation.BrushSprite.Brush);var y=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,f.default),l(t,[{key:"_deserializeSticker",value:function(e,t){var n=u.SDK.Operations.SpriteOperation,i=t.options,r=this._stickerManager.getStickerByIdentifier(i.identifier);if(!r)return u.Log.warn("Deserializer","Unknown sticker `"+i.identifier+"`. Skipping sprite."),Promise.resolve();var o=r.images.mediaBase,a=p.default.getURLForSticker(r,"base"),s=o.rawData?o.uris[0]:this._editor.getUI().getAssetPath(a),l=e.getInputDimensions(!1);return h.default.load(s).then(function(t){var o=n.StickerSprite.prototype.availableOptions.adjustments.structure,a=i.rotation,s=i.flipHorizontally,c=i.flipVertically,f={identifier:i.identifier,image:t,position:u.Vector2.fromObject(i.position),dimensions:u.Vector2.fromObject(i.dimensions).multiply(l.min()),rotation:a||0,flipHorizontally:s,flipVertically:c,resizeMode:r.resizeMode||"keepAspect",adjustments:{}};return void 0!==i.adjustments&&["brightness","contrast","saturation"].forEach(function(e){void 0!==i.adjustments[e]&&(f.adjustments[e]=i.adjustments[e]+o[e].default)}),void 0!==i.tintColor&&void 0!==r.tintMode&&(f.tintColor=u.Color.fromArray(i.tintColor.rgba),f.tintMode=r.tintMode),void 0!==i.alpha&&(f.alpha=i.alpha),e.createSticker(f)})}},{key:"_deserializeTransformOperation",value:function(e){return c(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_deserializeTransformOperation",this).call(this,e).then(function(e){if(e)return e._ratio=null,e})}},{key:"_deserializeInputImage",value:function(){var e=this,t=this._data.image,n=t.data,i=t.type,r=t.uri;return n&&i&&(r="data:"+i+";base64,"+n),r?h.default.load(r).then(function(t){e._editor.setImage(t)}):Promise.resolve()}},{key:"_deserializeAdjustmentsOperation",value:function(e){var n=u.SDK.Operations.AdjustmentsOperation;return c(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_deserializeAdjustmentsOperation",this).call(this,e).then(function(t){if(!t)return null;var i=e.options,r={};return["gamma","whites","blacks","temperature"].forEach(function(e){if(void 0!==i[e]){var t=n.prototype.availableOptions[e],o=t.minValue,a=t.midValue,s=t.maxValue,l=i[e];l=l<0?a+(a-o)*l:a+(s-a)*l,r[e]=l}}),t.set(r),t})}},{key:"_deserializeFocusOperation",value:function(e){var n=e.options.options;switch(e.options.type){case"radial":return c(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_deserializeFocusOperation",this).call(this,e);case"linear":var i=n.start,r=n.end,o=n.blurRadius;return Promise.resolve(this._editor.operations.getOrCreate("linear-focus",{controlPoint1:u.Vector2.fromObject(i),controlPoint2:u.Vector2.fromObject(r),blurRadius:o}));case"mirrored":var a=n.start,s=n.end,l=n.size,f=n.gradientSize,p=n.blurRadius;return Promise.resolve(this._editor.operations.getOrCreate("mirrored-focus",{start:u.Vector2.fromObject(a),end:u.Vector2.fromObject(s),size:l,gradientSize:f,blurRadius:p}));case"gaussian":var d=n.blurRadius;return Promise.resolve(this._editor.operations.getOrCreate("blur",{blurRadius:d}))}}},{key:"_deserializeText",value:function(e,t){var n=t.options,i=n.fontSize,r=n.lineHeight,o=n.fontIdentifier,a=n.alignment,s=n.rotation,l=n.maxWidth,c=n.color,f=n.backgroundColor,p=this._ui.getFontLoader(),d=this._fontManager.getVariationByIdentifier(o);return d?p.setFonts([d.getFont()]):d=this._fontManager.getDefaultVariation(),p.load().then(function(){var t=e.getInputDimensions(!1),o=l*t.min()/t.x,p=e.createText({fontSize:i,lineHeight:r,fontFamily:d.getFontFamily(),fontWeight:d.getFontWeight(),fontIdentifier:d.getIdentifier(),textMetrics:d.getTextMetrics(),alignment:a,rotation:s,maxWidth:o,text:n.text,color:u.Color.fromArray(c.rgba),backgroundColor:u.Color.fromArray(f.rgba),position:u.Vector2.fromObject(n.position)});return p._edited=!0,p})}},{key:"_createBrushForPath",value:function(e){var t=e.brush,n=t.identifier,i=t.color,s=t.size,l=t.hardness,c={color:u.Color.fromArray(i.rgba),size:s};void 0!==l&&(c.hardness=l);var f=this._brushManager.getBrushByIdentifier(n);if(f||(f=this._brushManager.getFirstBrush()),f.prototype&&f.prototype instanceof m)return new f(c);var p=u.SDKUtils.extend({},f);delete p.image;var d=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,m),t}();return d.identifier=f.identifier,new d(u.SDKUtils.extend({},p,c))}},{key:"_deserializeFrame",value:function(e,n){var i=this;return c(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_deserializeFrame",this).call(this,e,n).then(function(){var e=i._editor.operations.get("frame"),t=n.options,r=t.size,o=t.alpha,a=t.tintColor,s={};void 0!==r&&(s.scale=r),void 0!==o&&(s.alpha=o),void 0!==a&&(s.tintColor=u.Color.fromArray(a.rgba)),e.set(s)})}},{key:"_deserializeTextDesign",value:function(e,t){var n=this,i=t.options,r=i.position,o=i.rotation,a=i.flipHorizontally,l=i.flipVertically,c=i.text,f=i.color,p=i.width,h=i.seed,m=i.inverted,y=i.identifier;y===u.SDK.Operations.SpriteOperation.TextDesignSprite.Layouts.TextDesignBlocksLight.identifier?y=u.SDK.Operations.SpriteOperation.TextDesignSprite.LegacyLayouts.TextDesignBlocksLightV310.identifier:y===u.SDK.Operations.SpriteOperation.TextDesignSprite.Layouts.TextDesignSunshine.identifier&&(y=u.SDK.Operations.SpriteOperation.TextDesignSprite.LegacyLayouts.TextDesignSunshineV310.identifier);var g=new d.default(this._ui,this._getOptions("textdesign")),v=new _.default(this._ui,{fonts:u.Constants.DEFAULTS.TEXT_DESIGN_FONTS,replaceFonts:!0}),b=e.constructor.TextDesignSprite.AssetManager,k=this._ui.getFontLoader(),w=new(g.getLayoutByIdentifier(y));return k.setFonts(v.getFonts()),b.setFonts(s({},b.getFonts(),v.getVariationsByIdentifier())),k.load().then(function(){var t=w.getImagePaths().map(function(e){return{path:e,fullPath:n._ui.getAssetPath(e),image:null}});return b.loadImages(t).then(function(){return w.onImagesLoaded(),e.createTextDesign({position:r,rotation:o,flipHorizontally:a,flipVertically:l,text:c,color:u.Color.fromArray(f.rgba),width:p,seed:h,inverted:m,layout:w})})})}}]),t}();t.default=y,y.version="3.0.0"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=(n(0),function(e){return e&&e.__esModule?e:{default:e}}(n(54))),o=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.default),i(t,[{key:"_serializeTextDesign",value:function(e,t){var n=t.serializeOptions(["position","rotation","flipHorizontally","flipVertically","text","color","width","seed","inverted"],!0);n.color={rgba:n.color};var i=t.getLayout();return i&&(n.identifier=i.constructor.identifier),{type:"textdesign",options:n}}}]),t}();t.default=o,o.version="3.1.0"},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(0),s=i(n(55)),l=i(n(13)),c=i(n(9)),u=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.default),o(t,[{key:"_deserializeTextDesign",value:function(e,t){var n=this,i=t.options,o=i.position,s=i.rotation,u=i.flipHorizontally,f=i.flipVertically,p=i.text,d=i.color,h=i.width,_=i.seed,m=i.inverted,y=i.identifier;y===a.SDK.Operations.SpriteOperation.TextDesignSprite.Layouts.TextDesignBlocksLight.identifier?y=a.SDK.Operations.SpriteOperation.TextDesignSprite.LegacyLayouts.TextDesignBlocksLightV310.identifier:y===a.SDK.Operations.SpriteOperation.TextDesignSprite.Layouts.TextDesignSunshine.identifier&&(y=a.SDK.Operations.SpriteOperation.TextDesignSprite.LegacyLayouts.TextDesignSunshineV310.identifier);var g=new l.default(this._ui,this._getOptions("textdesign")),v=new c.default(this._ui,{fonts:a.Constants.DEFAULTS.TEXT_DESIGN_FONTS,replaceFonts:!0}),b=e.constructor.TextDesignSprite.AssetManager,k=this._ui.getFontLoader(),w=new(g.getLayoutByIdentifier(y));return k.setFonts(v.getFonts()),b.setFonts(r({},b.getFonts(),v.getVariationsByIdentifier())),k.load().then(function(){var t=w.getImagePaths().map(function(e){return{path:e,fullPath:n._ui.getAssetPath(e),image:null}});return b.loadImages(t).then(function(){return w.onImagesLoaded(),e.createTextDesign({position:o,rotation:s,flipHorizontally:u,flipVertically:f,text:p,color:a.Color.fromArray(d.rgba),width:h,seed:_,inverted:m,layout:w})})})}}]),t}();t.default=u,u.version="3.1.0"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(e){return e&&e.__esModule?e:{default:e}}(n(56)),o=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.default),i(t,[{key:"_serializeTextDesign",value:function(e,t){var n=t.serializeOptions(["position","rotation","flipHorizontally","flipVertically","text","color","width","seed","inverted","padding"],!0);n.color={rgba:n.color};var i=t.getLayout();return i&&(n.identifier=i.constructor.identifier),n.padding*=n.width,{type:"textdesign",options:n}}}]),t}();t.default=o,o.version="3.2.0"},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(0),s=i(n(57)),l=i(n(13)),c=i(n(9)),u=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.default),o(t,[{key:"_deserializeTextDesign",value:function(e,t){var n=this,i=t.options,o=i.position,s=i.rotation,u=i.flipHorizontally,f=i.flipVertically,p=i.text,d=i.color,h=i.width,_=i.seed,m=i.inverted,y=i.identifier;y===a.SDK.Operations.SpriteOperation.TextDesignSprite.Layouts.TextDesignBlocksLight.identifier?y=a.SDK.Operations.SpriteOperation.TextDesignSprite.LegacyLayouts.TextDesignBlocksLightV310.identifier:y===a.SDK.Operations.SpriteOperation.TextDesignSprite.Layouts.TextDesignSunshine.identifier&&(y=a.SDK.Operations.SpriteOperation.TextDesignSprite.LegacyLayouts.TextDesignSunshineV310.identifier);var g="padding"in i?i.padding/h:-1,v=new l.default(this._ui,this._getOptions("textdesign")),b=new c.default(this._ui,{fonts:a.Constants.DEFAULTS.TEXT_DESIGN_FONTS,replaceFonts:!0}),k=e.constructor.TextDesignSprite.AssetManager,w=this._ui.getFontLoader(),O=new(v.getLayoutByIdentifier(y));return w.setFonts(b.getFonts()),k.setFonts(r({},k.getFonts(),b.getVariationsByIdentifier())),w.load().then(function(){var t=O.getImagePaths().map(function(e){return{path:e,fullPath:n._ui.getAssetPath(e),image:null}});return k.loadImages(t).then(function(){return O.onImagesLoaded(),e.createTextDesign({position:o,rotation:s,flipHorizontally:u,flipVertically:f,text:p,color:a.Color.fromArray(d.rgba),width:h,seed:_,inverted:m,layout:O,padding:g})})})}}]),t}();t.default=u,u.version="3.2.0"},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=i(n(58)),a=i(n(17)),s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),r(t,[{key:"_serializeOperation",value:function(e,n){switch(e.constructor.identifier){case"artfilter":return this._serializeStyle(e);default:return function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_serializeOperation",this).call(this,e,n)}}},{key:"_serializeOrientationOperation",value:function(e){return{type:"orientation",options:e.serializeOptions(["flipVertically","flipHorizontally","rotation"],!0)}}},{key:"_serializeStyle",value:function(e){var t=e.getOptions(),n=t.identifier,i=t.intensity,r=t.blendMode,o=e.getStyleTransferModel().getOptions(),s=o.tileEdgeLength,l=o.overlappingFactor;return{type:"artFilter",options:{identifier:n,intensity:i,blendMode:a.default[r],tileEdgeLength:s,overlappingFactor:l}}}}]),t}();t.default=s,s.version="3.4.0"},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(59)),s=(i(n(13)),i(n(9)),i(n(198))),l=i(n(17)),c=o.SDKUtils.flipObject(l.default),u=o.SDK.Operations.ArtFilterOperation,f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),r(t,[{key:"_deserializeOperation",value:function(e){return"artFilter"===e.type?this._deserializeStyle(e):function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_deserializeOperation",this).call(this,e)}},{key:"_deserializeOrientationOperation",value:function(e){var t=e.options,n=this._editor.operations.getOrCreate("orientation");return n?(n.set(t),Promise.resolve(n)):Promise.resolve()}},{key:"_deserializeStyle",value:function(e){var t=this,n=e.options,i=n.identifier,r=n.intensity,a=n.blendMode,l=n.tileEdgeLength,f=n.overlappingFactor;return i?u.isSupported(this._editor.getSDK())?new s.default(this._ui,this._getOptions("artfilter")).instantiateStyleTransferModelForArtFilterWithIdentifier(i,{tileEdgeLength:l,overlappingFactor:f}).catch(function(e){o.Log.warn("Could not deserialize art filter: "+e)}).then(function(e){t._editor.operations.getOrCreate("artfilter",{identifier:i,styleTransferModel:e,intensity:r,blendMode:parseInt(c[a||a],10)})}):(o.Log.warn("Can't restore Art Filters, as they're not supported on this platform."),Promise.resolve()):(o.Log.warn("Found invalid Art Filter serialization."),Promise.resolve())}}]),t}();t.default=f,f.version="3.4.0"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){return e&&e.__esModule?e:{default:e}}(n(60)),r=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i.default),t}();t.default=r,r.version="3.5.0"},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(0),s=i(n(61)),l=i(n(13)),c=i(n(9)),u=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.default),o(t,[{key:"_deserializeTextDesign",value:function(e,t){var n=this,i=t.options,o=i.position,s=i.rotation,u=i.flipHorizontally,f=i.flipVertically,p=i.text,d=i.color,h=i.width,_=i.seed,m=i.inverted,y=i.identifier,g="padding"in i?i.padding/h:-1,v=new l.default(this._ui,this._getOptions("textdesign")),b=new c.default(this._ui,{fonts:a.Constants.DEFAULTS.TEXT_DESIGN_FONTS,replaceFonts:!0}),k=e.constructor.TextDesignSprite.AssetManager,w=this._ui.getFontLoader(),O=new(v.getLayoutByIdentifier(y));return w.setFonts(b.getFonts()),k.setFonts(r({},k.getFonts(),b.getVariationsByIdentifier())),w.load().then(function(){var t=O.getImagePaths().map(function(e){return{path:e,fullPath:n._ui.getAssetPath(e),image:null}});return k.loadImages(t).then(function(){return O.onImagesLoaded(),e.createTextDesign({position:o,rotation:s,flipHorizontally:u,flipVertically:f,text:p,color:a.Color.fromArray(d.rgba),width:h,seed:_,inverted:m,layout:O,padding:g})})})}}]),t}();t.default=u,u.version="3.5.0"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function(e){return e&&e.__esModule?e:{default:e}}(n(62)),a=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),r(t,[{key:"_serializeAdjustmentsOperation",value:function(e){var n=function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_serializeAdjustmentsOperation",this).call(this,e),r={},o=e.availableOptions.sharpness,a=e.getOption("sharpness"),s=o.minValue,l=o.midValue,c=o.maxValue;return r.sharpness=a<=l?(a-s)/(l-s)-1:(a-l)/(c-l),n.options=i({},n.options,r),n}}]),t}();t.default=a,a.version="3.6.0"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(63)),a=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),i(t,[{key:"_deserializeAdjustmentsOperation",value:function(e){var n=r.SDK.Operations.AdjustmentsOperation;return function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_deserializeAdjustmentsOperation",this).call(this,e).then(function(t){if(!t)return null;var i=e.options,r={};if(void 0!==i.sharpness){var o=n.prototype.availableOptions.sharpness,a=o.minValue,s=o.midValue,l=o.maxValue,c=i.sharpness;return c=c<0?s+(s-a)*c:s+(l-s)*c,r.sharpness=c,t.set(r),t}})}}]),t}();t.default=a,a.version="3.6.0"},function(e,t,n){"use strict";/*!
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2019 img.ly GmbH <contact@img.ly>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */
n(67),e.exports=n(68).default},function(e,t){},function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),c=n(0),u=r(n(93)),f=r(n(2)),p=r(n(3)),d=r(n(1)),h=r(n(21)),_=r(n(209)),m=i(n(210)),y=r(n(4)),g=i(n(42)),v=r(n(15)),b=r(n(7)),k=r(n(30)),w=function(e){return c.SDKUtils.byteArrayToString(c.Base64.decode(e))},O=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n._mediator=new c.EventEmitter,n._fontLoader=new k.default(n),n._options=e,n._initOptions(),n._initLanguage(),n._initEvents(),n._disposed=!1,n._isReady=!1,n._mediator.once(c.Constants.EVENTS.EDITOR_READY,function(){n._isReady=!0}),n._globalState=new c.SharedState,n._preloader=new _.default(n,n._options,n._mediator),c.Log.setLevel(n._options.logLevel),n._options.license&&!n._v()||n.run(),n}return s(t,c.EventEmitter),l(t,[{key:"run",value:function(){this._registerWebFonts(),this._options.container.style.position="relative",this._render()}},{key:"_render",value:function(){var e=this,t=c.React.createElement(u.default,{ui:this,mediator:this._mediator,ref:function(t){e._component=t},globalState:this._globalState,options:this._options});if(this._options.renderReturnsComponent)return t;c.ReactDOM.render(t,this._options.container)}},{key:"export",value:function(){var e;return(e=this._component).export.apply(e,arguments)}},{key:"serialize",value:function(){var e;return(e=this._component).serialize.apply(e,arguments)}},{key:"deserialize",value:function(e){return this._component.deserialize(e)}},{key:"getEditor",value:function(){return this._component.getEditor()}},{key:"isReady",value:function(){return this._isReady}},{key:"onReady",value:function(e){this._isReady?e():(this._mediator.once(c.Constants.EVENTS.EDITOR_READY,e),this._isReady=!0)}},{key:"_initOptions",value:function(){this._options=c.SDKUtils.defaults(this._options,{language:"en",title:"PhotoEditor SDK",logLevel:"warn",crossOrigin:"anonymous",preloader:!0,editor:{},assets:{},photoRoll:{},enableUpload:!0,enableWebcam:!0,showCloseButton:!1,showHeader:!0,showTopBar:!0,responsive:!1}),this._options.editor=c.SDKUtils.defaults(this._options.editor||{},{pixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1,preferredRenderer:"webgl",enableZoom:!0,enableDrag:!0,smoothDownscaling:!1,smoothUpscaling:!1,displayResizeMessage:!0,maxMegaPixels:{},forceControls:[],forceCrop:!1,watermarkImage:null,tools:["transform","filter","brightness","saturation","contrast","sharpness","clarity","exposure","shadows","highlights","gamma","whites","blacks","temperature","text","sticker","brush","radial-focus","mirrored-focus","frame"],controlsOrder:["transform",["filter","adjustments"],["text","sticker","brush"],["selectiveBlur","focus","frame"]],operationsOrder:["exif-orientation","orientation","transform","filter","adjustments","radial-focus","mirrored-focus","selective-blur","sprite","frame","watermark"],controlsOptions:{}}),this._options.editor.maxMegaPixels=c.SDKUtils.defaults(this._options.editor.maxMegaPixels,{mobile:5,desktop:10}),this._options.editor.export=c.SDKUtils.defaults(this._options.editor.export||{},{showButton:!0,format:"image/png",type:c.RenderType.IMAGE,download:!0,fileBasename:"photoeditorsdk-export",quality:.8}),this._options.photoRoll=c.SDKUtils.defaults(this._options.photoRoll||{},{provider:null}),this._options.extensions=c.SDKUtils.defaults(this._options.extensions||{},{languages:{},operations:[],controls:[]}),this._options.assets=c.SDKUtils.defaults(this._options.assets||{},{baseUrl:"assets",resolver:null})}},{key:"_v",value:function(){return!!this[w("X29wdGlvbnM=")][w("bGljZW5zZQ==")]||(c.Log.error(w("TGljZW5zaW5n"),w("Tm8gYGxpY2Vuc2VgIG9wdGlvbiBnaXZlbi4=")),c.Log.error(w("TGljZW5zaW5n"),w("SW4gY2FzZSB5b3UgZG9uJ3QgaGF2ZSBhIGxpY2Vuc2UgeWV0LCBwbGVhc2UgY29udGFjdCBvdXIgc2FsZXMgc3RhZmYgYXQgc2FsZXNAcGhvdG9lZGl0b3JzZGsuY29tIHRvIG9idGFpbiBhIGxpY2Vuc2Ugb3IgbG9nIGluIHRvIHlvdXIgY3VzdG9tZXIgZGFzaGJvYXJkLg==")),!1)}},{key:"_registerWebFonts",value:function(){var e='\n      // Injected by PhotoEditorSDK\n      @font-face {\n        font-family: "__pesdk_Montserrat";\n        src: url(\''+this.getAssetPath("fonts/montserrat-regular.woff",!0,!0)+"') format('woff');\n        font-weight: normal;\n        font-style: normal;\n      }\n\n      @font-face {\n        font-family: \"__pesdk_Montserrat\";\n        src: url('"+this.getAssetPath("fonts/montserrat-light.woff",!0,!0)+"') format('woff');\n        font-weight: 100;\n        font-style: normal;\n      }\n    ";this._webFontsStyle=document.createElement("style"),this._webFontsStyle.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(this._webFontsStyle)}},{key:"_initEvents",value:function(){this._mediator.pipeEvents(this)}},{key:"_disposeEvents",value:function(){this._mediator.unpipeEvents(this)}},{key:"_initLanguage",value:function(){this._languages=c.SDKUtils.deepDefaults(this._options.extensions.languages,{de:n(215),en:n(216)}),this._language=this._languages[this._options.language],this._language||c.Log.error(this.constructor.name,"Language `"+this._options.language+"` not found!")}},{key:"translate",value:function(e,t){return c.Utils.translate(this._language,e,t)}},{key:"setImage",value:function(e){this._component&&this._component.setImage(e)}},{key:"getAssetPath",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=this._options.assets,r=i.baseUrl,o=i.resolver,a=r+"/"+e;return e.match(/(ftp|http|https):\/\//)&&(a=e),t&&(n||("undefined"!=typeof window&&window.devicePixelRatio||1)>1&&(e=e.replace(/\.[\w?=]+$/,function(e){return"@2x"+e})),a=r+"/ui/react/"+e),void 0!==o&&null!==o&&(a=o(a)),a}},{key:"getFontLoader",value:function(){return this._fontLoader}},{key:"getPreloader",value:function(){return this._preloader}},{key:"dispose",value:function(){if(this._disposed)throw new Error("This instance of PhotoEditorSDK is already disposed.");this._disposed=!0,this._webFontsStyle.parentNode.removeChild(this._webFontsStyle),c.ReactDOM.unmountComponentAtNode(this._options.container),this._disposeEvents()}}]),t}();O.prototype.identifier="react",O.BaseComponent=c.BaseComponent,O.BaseControls=y.default,O.ControlsComponent=p.default,O.React=c.React,O.ReactBEM=c.ReactBEM,O.SharedState=c.SharedState,O.Constants=c.Constants,O.Events=c.Constants.EVENTS,O.Utils=c.Utils,O.ScrollbarComponent=f.default,O.ModalManager=d.default,O.JSONLoader=h.default,O.PhotoRoll=m,O.Controls=g,O.SliderComponent=v.default,O.SliderOverlayComponent=b.default;var E=function(e){function t(){return o(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return s(t,c.React.Component),l(t,[{key:"componentDidMount",value:function(){this._ui=new O(c.SDKUtils.extend({},this.props,{container:this.refs.container})),this.props.onEditorReady&&this._ui.onReady(this.props.onEditorReady)}},{key:"render",value:function(){var e=c.SDKUtils.extend({},this.props.style||{});return c.React.createElement("div",{style:e,ref:"container"})}},{key:"ui",get:function(){return this._ui}}]),t}();O.ReactComponent=E,c.SDK.UI=c.SDK.UI||{},c.SDK.UI.ReactUI=O,t.default=O},function(e,t){e.exports=n},function(e,t,n){"use strict";function i(){}function r(){}var o=n(71);r.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,r,a){if(a!==o){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:r,resetWarningCache:i};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=i(n(18)),a=i(n(33)),s=i(n(36)),l=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._events={},o._needsStyleFixes=!1,o._bindAll("_onSharedStateUpdate","fixStyles"),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default.Component),r(t,[{key:"fixStyles",value:function(){}},{key:"componentDidMount",value:function(){this._bindEvents(),this.props.sharedState&&this.props.sharedState.on("update",this._onSharedStateUpdate),this._needsStyleFixes&&(this.fixStyles(),this.context.options.responsive&&window.addEventListener("resize",this.fixStyles))}},{key:"componentWillUnmount",value:function(){this._unbindEvents(),this.props.sharedState&&this.props.sharedState.off("update",this._onSharedStateUpdate),this.context.options.responsive&&this._needsStyleFixes&&window.removeEventListener("resize",this.fixStyles)}},{key:"componentWillReceiveProps",value:function(e){e.sharedState&&(this.props.sharedState&&this.props.sharedState.off("update",this._onSharedStateUpdate),e.sharedState.on("update",this._onSharedStateUpdate))}},{key:"_bindAll",value:function(){for(var e=this,t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];n.forEach(function(t){if("function"!=typeof e[t])throw new Error("_bindAll: "+e.constructor.name+"."+t+" is not a function.");e[t]=e[t].bind(e)})}},{key:"_t",value:function(e,t){return this.context.ui.translate(e,t)}},{key:"_getAssetPath",value:function(){var e;return(e=this.context.ui).getAssetPath.apply(e,arguments)}},{key:"_onSharedStateUpdate",value:function(e,t){this.sharedStateDidChange(t),this.shouldSharedComponentUpdate(e,t)&&this.forceUpdate()}},{key:"shouldSharedComponentUpdate",value:function(e,t){return!0}},{key:"sharedStateDidChange",value:function(e){}},{key:"setSharedState",value:function(e,t){this.props.sharedState.set(e,t)}},{key:"getSharedState",value:function(e){return this.props.sharedState.get(e)}},{key:"forceSharedUpdate",value:function(){this.props.sharedState.broadcastUpdate()}},{key:"_bindEvents",value:function(){for(var e in this._events){var t=this._events[e];this.context.mediator.on(e,t)}}},{key:"_unbindEvents",value:function(){for(var e in this._events){var t=this._events[e];this.context.mediator.off(e,t)}}},{key:"_emitEvent",value:function(e){for(var t,n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];(t=this.context.mediator).emit.apply(t,[e].concat(i))}},{key:"renderWithBEM",value:function(){return s.default.createElement("div")}},{key:"render",value:function(){return s.default.transform(this.renderWithBEM())}}]),t}();t.default=l,l.contextTypes={editor:a.default.object,ui:a.default.object,options:a.default.object,mediator:a.default.object,editorScreen:a.default.object,globalState:a.default.object},l.propTypes={sharedState:a.default.any}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=i(n(5)),o=i(n(19)),a=i(n(77)),s=i(n(21)),l=r.default.Utils,c=r.default.Math.Vector2,u={getInnerDimensionsForElement:function(e){var t=new c(e.offsetWidth,e.offsetHeight),n=window.getComputedStyle(e,null);return t.x-=parseInt(n.getPropertyValue("padding-left"),10),t.x-=parseInt(n.getPropertyValue("padding-right"),10),t.y-=parseInt(n.getPropertyValue("padding-top"),10),t.y-=parseInt(n.getPropertyValue("padding-bottom"),10),t},getEventPosition:function(e){var t=e.clientX,n=e.clientY;if(-1!==e.type.indexOf("touch")){if(!e.touches.length)return;t=e.touches[0].clientX,n=e.touches[0].clientY}return new c(t,n)},createTransparentPatternCanvas:function(){var e=document.createElement("canvas"),t=e.getContext("2d");return e.width=10,e.height=10,t.fillStyle="white",t.fillRect(0,0,e.width,e.height),t.fillStyle="#cccccc",t.fillRect(0,0,e.width/2,e.height/2),t.fillRect(e.width/2,e.height/2,e.width,e.height),e},supportsMSBlob:function(){return void 0!==document.createElement("canvas").msToBlob},translate:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.fetch(e,t);if(!r){o.default.info("Utils#translate","Unable to translate `"+t+"`");var a=n(88)[t];return null!=a?(o.default.warn("Utils#translate","Trying to find localized string for old key: `"+a+"`. Please update your localization to use the new key as soon as possible. Support for the old, deprecated key will be dropped with the next major version update."),this.translate(e,a,i)):null}for(var s in i)r=r.replace("${"+s+"}",i[s]);return r},fetch:function(e,t,n){for(var i=(t=(t=t.replace(/\[(\w+)]/g,".$1")).replace(/^\./,"")).split("."),r=0;r<i.length&&(e=e[i[r]]);r++);return void 0!==e&&e},isMobile:function(){var e=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))},isTouchDevice:function(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch)},select:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;n||(n=function(e){return e});var i=[];return t.forEach(function(t){e.forEach(function(e){n(e)===t&&i.push(e)})}),i},getJSONP:function(e){return new s.default(e).load()},cloneCategories:function(e,t){return e.map(function(e){return(e=l.clone(e))[t]=e[t].slice(0),e})},mergeCategories:function(e,t,n){e=this.cloneCategories(e,n);var i=null;return t.forEach(function(t){e.forEach(function(e){t.identifier===e.identifier&&(i=e)}),i?i[n]=i[n].concat(t[n]):e.push(t)}),e},wrapFiltersInCategories:function(e,t){return e.map(function(e){var n=e;return t in n||(n=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({identifier:"imgly_filters_wrapped-"+e.identifier,displayFlat:!0},t,[e])),n})},getStyleObject:function(e){var t=window.getComputedStyle(e),n={};for(var i in t){var r=t.getPropertyValue(i),o=i.replace(/-([a-z])/g,function(e,t){return t.toUpperCase()});""!==r&&(n[o]=r)}return n},debounce:function(e,t,n){var i;return function(){var r=this,o=arguments,a=n&&!i;clearTimeout(i),i=setTimeout(function(){i=null,n||e.apply(r,o)},t),a&&e.apply(this,o)}},getScrollbarWidth:function(){var e=document.createElement("div");e.style.visibility="hidden",e.style.width="100px",e.style.msOverflowStyle="scrollbar",document.body.appendChild(e);var t=e.offsetWidth;e.style.overflow="scroll";var n=document.createElement("div");n.style.width="100%",e.appendChild(n);var i=n.offsetWidth;return e.parentNode.removeChild(e),t-i},capitalize:function(e){return e.charAt(0).toUpperCase()+e.slice(1)},Browser:a.default};t.default=u},function(e,t,n){"use strict";(function(e){function i(e){return e&&e.__esModule?e:{default:e}}function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=i(n(75)),c=i(n(76)),u=function(){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t)}return s(t,null,[{key:"isArray",value:function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{key:"mapRange",value:function(e,t,n){return(e-t.getMin())*n.getLength()/t.getLength()+n.getMin()}},{key:"isPlainObject",value:function(e){if("object"!==(void 0===e?"undefined":a(e))||!e)return!1;if("function"==typeof Object.getPrototypeOf){var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}return"[object Object]"===Object.prototype.toString.call(e)}},{key:"isMobile",value:function(){if("undefined"==typeof navigator)return!1;var e=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))}},{key:"isBrowser",value:function(){return"undefined"!=typeof window}},{key:"isNode",value:function(){return"undefined"==typeof window&&void 0!==e}},{key:"values",value:function(e){var t=[];for(var n in e)t.push(e[n]);return t}},{key:"generateUUID",value:function(){var e=(new Date).getTime();return void 0!==window.performance&&"function"==typeof window.performance.now&&(e+=window.performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?n:3&n|8).toString(16)})}},{key:"isDOMElement",value:function(e){return"object"===("undefined"==typeof HTMLElement?"undefined":a(HTMLElement))?e instanceof HTMLElement:e&&"object"===(void 0===e?"undefined":a(e))&&null!==e&&1===e.nodeType&&"string"==typeof e.nodeName}},{key:"isTouchEvent",value:function(e){return-1!==e.type.indexOf("touch")}},{key:"resizeVectorToFit",value:function(e,t){var n=Math.min(t.x/e.x,t.y/e.y);return e.clone().multiply(n)}},{key:"resizeVectorToFill",value:function(e,t){var n=e.x/e.y;return n>t.x/t.y?t.clone().set(t.y*n,t.y):t.clone().set(t.x,t.x/n)}},{key:"isExtendable",value:function(e){return void 0!==e&&null!==e&&("object"===(void 0===e?"undefined":a(e))||"function"==typeof e)}},{key:"defaults",value:function(e){var t={};for(var n in e)t[n]=e[n];for(var i=arguments.length,r=Array(i>1?i-1:0),o=1;o<i;o++)r[o-1]=arguments[o];for(var a=0;a<r.length;a++){var s=r[a];for(var l in s)void 0===t[l]&&(t[l]=s[l])}return t}},{key:"deepMerge",value:function(e){for(var n=arguments.length,i=Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];return i.reduce(function e(n,i){if(void 0===i)return e(null,n);if(Array.isArray(i))return[].concat(r(i));if(!t.isPlainObject(i))return i;if(!t.isPlainObject(n))return o({},i);var a=o({},n);return Object.keys(i).forEach(function(t){var r=i[t];void 0!==r&&(a[t]=e(n[t],r))}),a},e)}},{key:"deepDefaults",value:function(e){for(var n=arguments.length,i=Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];var a=[].concat(i).reverse();return t.deepMerge.apply(t,r(a).concat([e]))}},{key:"deepClone",value:function(e){var n={};for(var i in e)t.isExtendable(e[i])?n[i]=t.deepClone(e[i]):n[i]=e[i];return n}},{key:"getDeepProperty",value:function(e,t){return"string"==typeof t?e[t]:Array.isArray(t)?t.reduce(function(e,t){return e?"function"==typeof t?function(e,t){var n=void 0;try{n=t(e)}catch(e){if(!(e instanceof TypeError))throw e}return n}(e,t):e[t]:null},e):void 0}},{key:"extend",value:function(e){var t={};for(var n in e)t[n]=e[n];for(var i=arguments.length,r=Array(i>1?i-1:0),o=1;o<i;o++)r[o-1]=arguments[o];for(var a=0;a<r.length;a++){var s=r[a];for(var l in s)t[l]=s[l]}return t}},{key:"clone",value:function(e){return this.extend({},e)}},{key:"createBlobURIFromDataURI",value:function(t){var n="undefined"==typeof window?e:window;if(!(n.Blob&&n.URL&&ArrayBuffer&&Uint8Array))return t;for(var i=l.default.decode(t.split(",")[1]),r=t.split(",")[0].split(":")[1].split(";")[0],o=new ArrayBuffer(i.length),a=new Uint8Array(o),s=0;s<i.length;s++)a[s]=i[s];var c=new n.Blob([o],{type:r});return n.URL.createObjectURL(c)}},{key:"getUUID",value:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}},{key:"createCanvas",value:function(){return document.createElement("canvas")}},{key:"convertHtmlImageToRGBACanvas",value:function(e,n){var i=n||t.createCanvas();i.width=e.width,i.height=e.height;var r=i.getContext("2d");return r.clearRect(0,0,i.width,i.height),r.drawImage(e,0,0,e.width,e.height),i}},{key:"isPowerOfTwo",value:function(e){return 0==(e.x&e.x-1)&&0==(e.y&e.y-1)}},{key:"nextLowestPOT",value:function(e){for(var t=1;t<32;t<<=1)e|=e>>t;return e-(e>>1)}},{key:"nextHighestPOT",value:function(e){e--;for(var t=1;t<32;t<<=1)e|=e>>t;return e+1}},{key:"moveArrayItem",value:function(e,t,n){if(n>=e.length)for(var i=n-e.length;1+i--;)e.push(void 0);e.splice(n,0,e.splice(t,1)[0])}},{key:"ensureCanvasDimensions",value:function(e,t){e.width===t.x&&e.height===t.y||(e.width=t.x,e.height=t.y)}},{key:"byteArrayToString",value:function(e){return e.map(function(e){return String.fromCharCode(e)}).join("")}},{key:"clamp",value:function(e,t,n){return Math.max(t,Math.min(e,n))}},{key:"wildCardMatch",value:function(e,t){return new RegExp("^"+t.split("*").join(".*")+"$").test(e)}},{key:"flipObject",value:function(e){var t={};for(var n in e)t[e[n]]=n;return t}},{key:"cloneOptions",value:function(e){var t={};for(var n in e){var i=e[n];Array.isArray(i)?i=i.slice():i.clone&&(i=i.clone()),t[n]=i}return t}},{key:"ISODateString",value:function(e){function t(e){return e<10?"0"+e:e}return e.getUTCFullYear()+"-"+t(e.getUTCMonth()+1)+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"Z"}},{key:"getCrossOriginValue",value:function(e){return e?"none"!==e?e:void 0:"anonymous"}},{key:"shallowEqual",value:function(e,t){if(e===t)return!0;if("object"!==(void 0===e?"undefined":a(e))||null===e||"object"!==(void 0===t?"undefined":a(t))||null===t)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(var r=hasOwnProperty.bind(t),o=0;o<n.length;o++)if(!r(n[o])||e[n[o]]!==t[n[o]])return!1;return!0}},{key:"enableIf",value:function(e,t){return e?t:void 0}},{key:"invariant",value:function(e,t){if(!e)throw new Error(t)}},{key:"executePromises",value:function(e){var t=e.length,n=0,i=[],r=[];return new Promise(function(o,a){var s=function(){++n>=t&&(r.length<=0?o(i):a(r))},l=function(e){i.push(e),s()},c=function(e){r.push(e),s()};e.forEach(function(e){e.then(l).catch(c)})})}}]),t}();u.Array=c.default,t.default=u}).call(t,n(8))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});/*
 * Extracted from MinifyJpeg (Copyright (c) 2014 Hiroaki Matoba, MIT License):
 * https://github.com/hMatoba/MinifyJpeg
 * @license
 */
var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r={encode:function(e){var t="",n=void 0,r=void 0,o=void 0,a=void 0,s=void 0,l=void 0,c=void 0,u=0;do{a=(n=e[u++])>>2,s=(3&n)<<4|(r=e[u++])>>4,l=(15&r)<<2|(o=e[u++])>>6,c=63&o,isNaN(r)?l=c=64:isNaN(o)&&(c=64),t=t+i.charAt(a)+i.charAt(s)+i.charAt(l)+i.charAt(c),n=r=o="",a=s=l=c=""}while(u<e.length);return t},decode:function(e){var t=void 0,n=void 0,r=void 0,o=void 0,a=void 0,s=void 0,l=0,c=[];if(/[^A-Za-z0-9+\/=]/g.exec(e))throw new Error("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\nExpect errors in decoding.");e=e.replace(/[^A-Za-z0-9+\/=]/g,"");do{t=i.indexOf(e.charAt(l++))<<2|(o=i.indexOf(e.charAt(l++)))>>4,n=(15&o)<<4|(a=i.indexOf(e.charAt(l++)))>>2,r=(3&a)<<6|(s=i.indexOf(e.charAt(l++))),c.push(t),64!==a&&c.push(n),64!==s&&c.push(r),t=n=r="",o=a=s=""}while(l<e.length);return c}};t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return i(e,null,[{key:"head",value:function(e){return e[0]}},{key:"tail",value:function(e){return e.slice(1)}},{key:"last",value:function(e){return e[e.length-1]}},{key:"init",value:function(e){return e.slice(0,e.length-1)}},{key:"remove",value:function(e,t){return e.filter(function(e,n,i){return!t(e,n,i)})}},{key:"findIndex",value:function(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n;return-1}},{key:"find",value:function(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}},{key:"flatten",value:function(t){return t.reduce(function(t,n){return t.concat(Array.isArray(n)?e.flatten(n):n)},[])}},{key:"range",value:function(e,t){var n=[];if(t>e)for(var i=e;i<t;i++)n.push(i);return n}},{key:"repeat",value:function(e,t){for(var n=[],i=0;i<t;i++)n[i]=e;return n}},{key:"zip",value:function(e,t){for(var n=Math.min(e.length,t.length),i=[],r=0;r<n;r++)i[r]=[e[r],t[r]];return i}}]),e}();t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={getIEVersion:function(){var e=navigator,t=e.userAgent,n=e.appVersion;return-1!==n.indexOf("MSIE")?n.match(/MSIE\s+?([0-9]+)/i)[1]:-1!==t.indexOf("Trident")&&t.match(/rv:([0-9]+)/i)[1]},isIE10:function(){var e=this.getIEVersion();return!1!==e&&10===e},isIE11:function(){var e=this.getIEVersion();return!1!==e&&11===e},isIElte:function(e){var t=this.getIEVersion();return!1!==t&&t<=e}}},function(e,t,n){"use strict";(function(e,n){Object.defineProperty(t,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=void 0===n?window:n,o="undefined"!=typeof Promise?Promise:function(){function t(e,t){p.add(e,t),f||(f=h(p.drain))}function n(e){var t,n=void 0===e?"undefined":i(e);return null==e||"object"!=n&&"function"!=n||(t=e.then),"function"==typeof t&&t}function r(){for(var e=0;e<this.chain.length;e++)o(this,1===this.state?this.chain[e].success:this.chain[e].failure,this.chain[e]);this.chain.length=0}function o(e,t,i){var r,o;try{!1===t?i.reject(e.msg):(r=!0===t?e.msg:t.call(void 0,e.msg))===i.promise?i.reject(TypeError("Promise-chain cycle")):(o=n(r))?o.call(r,i.resolve,i.reject):i.resolve(r)}catch(e){i.reject(e)}}function a(e){var n=this;n.triggered||(n.triggered=!0,n.def&&(n=n.def),n.msg=e,n.state=2,n.chain.length>0&&t(r,n))}function s(e,t,n,i){for(var r=0;r<t.length;r++)!function(r){e.resolve(t[r]).then(function(e){n(r,e)},i)}(r)}function l(e){this.def=e,this.triggered=!1}function c(e){if("function"!=typeof e)throw TypeError("Not a function");if(0!==this.__NPO__)throw TypeError("Not a promise");this.__NPO__=1;var i=new function(e){this.promise=e,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}(this);this.then=function(e,n){var o={success:"function"!=typeof e||e,failure:"function"==typeof n&&n};return o.promise=new this.constructor(function(e,t){if("function"!=typeof e||"function"!=typeof t)throw TypeError("Not a function");o.resolve=e,o.reject=t}),i.chain.push(o),0!==i.state&&t(r,i),o.promise},this.catch=function(e){return this.then(void 0,e)};try{e.call(void 0,function(e){(function e(i){var o,s=this;if(!s.triggered){s.triggered=!0,s.def&&(s=s.def);try{(o=n(i))?t(function(){var t=new l(s);try{o.call(i,function(){e.apply(t,arguments)},function(){a.apply(t,arguments)})}catch(e){a.call(t,e)}}):(s.msg=i,s.state=1,s.chain.length>0&&t(r,s))}catch(e){a.call(new l(s),e)}}}).call(i,e)},function(e){a.call(i,e)})}catch(e){a.call(i,e)}}var u,f,p,d=Object.prototype.toString,h=void 0!==e?function(t){return e(t)}:setTimeout;try{Object.defineProperty({},"x",{}),u=function(e,t,n,i){return Object.defineProperty(e,t,{value:n,writable:!0,configurable:!1!==i})}}catch(e){u=function(e,t,n){return e[t]=n,e}}p=function(){var e,t,n;return{add:function(i,r){n=new function(e,t){this.fn=e,this.self=t,this.next=void 0}(i,r),t?t.next=n:e=n,t=n,n=void 0},drain:function(){var n=e;for(e=t=f=void 0;n;)n.fn.call(n.self),n=n.next}}}();var _=u({},"constructor",c,!1);return c.prototype=_,u(_,"__NPO__",0,!1),u(c,"resolve",function(e){return e&&"object"==(void 0===e?"undefined":i(e))&&1===e.__NPO__?e:new this(function(t,n){if("function"!=typeof t||"function"!=typeof n)throw TypeError("Not a function");t(e)})}),u(c,"reject",function(e){return new this(function(t,n){if("function"!=typeof t||"function"!=typeof n)throw TypeError("Not a function");n(e)})}),u(c,"all",function(e){var t=this;return"[object Array]"!=d.call(e)?t.reject(TypeError("Not an array")):0===e.length?t.resolve([]):new t(function(n,i){if("function"!=typeof n||"function"!=typeof i)throw TypeError("Not a function");var r=e.length,o=Array(r),a=0;s(t,e,function(e,t){o[e]=t,++a===r&&n(o)},i)})}),u(c,"race",function(e){var t=this;return"[object Array]"!=d.call(e)?t.reject(TypeError("Not an array")):new t(function(n,i){if("function"!=typeof n||"function"!=typeof i)throw TypeError("Not a function");s(t,e,function(e,t){n(t)},i)})}),c}();/*!
 * Native Promise Only
 * v0.8.0-a (c) Kyle Simpson
 * MIT License: http://getify.mit-license.org
 */
r.Promise=r.Promise||o,t.default=o}).call(t,n(79).setImmediate,n(8))},function(e,t,n){(function(e){function i(e,t){this._id=e,this._clearFn=t}var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;t.setTimeout=function(){return new i(o.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new i(o.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(80),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,n(8))},function(e,t,n){(function(e,t){!function(e,n){"use strict";function i(e){delete s[e]}function r(e){if(l)setTimeout(r,0,e);else{var t=s[e];if(t){l=!0;try{!function(e){var t=e.callback,i=e.args;switch(i.length){case 0:t();break;case 1:t(i[0]);break;case 2:t(i[0],i[1]);break;case 3:t(i[0],i[1],i[2]);break;default:t.apply(n,i)}}(t)}finally{i(e),l=!1}}}}if(!e.setImmediate){var o,a=1,s={},l=!1,c=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,"[object process]"==={}.toString.call(e.process)?o=function(e){t.nextTick(function(){r(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?function(){var t="setImmediate$"+Math.random()+"$",n=function(n){n.source===e&&"string"==typeof n.data&&0===n.data.indexOf(t)&&r(+n.data.slice(t.length))};e.addEventListener?e.addEventListener("message",n,!1):e.attachEvent("onmessage",n),o=function(n){e.postMessage(t+n,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){r(e.data)},o=function(t){e.port2.postMessage(t)}}():c&&"onreadystatechange"in c.createElement("script")?function(){var e=c.documentElement;o=function(t){var n=c.createElement("script");n.onreadystatechange=function(){r(t),n.onreadystatechange=null,e.removeChild(n),n=null},e.appendChild(n)}}():o=function(e){setTimeout(r,0,e)},u.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];var i={callback:e,args:t};return s[a]=i,o(a),a++},u.clearImmediate=i}}("undefined"==typeof self?void 0===e?this:e:self)}).call(t,n(8),n(20))},function(e,t,n){"use strict";function i(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function r(e,t,n){if(e&&a.isObject(e)&&e instanceof i)return e;var r=new i;return r.parse(e,t,n),r}var o=n(82),a=n(84);t.parse=r,t.resolve=function(e,t){return r(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?r(e,!1,!0).resolveObject(t):t},t.format=function(e){return a.isString(e)&&(e=r(e)),e instanceof i?e.format():i.prototype.format.call(e)},t.Url=i;var s=/^([a-z0-9.+-]+:)/i,l=/:[0-9]*$/,c=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),f=["'"].concat(u),p=["%","/","?",";","#"].concat(f),d=["/","?","#"],h=/^[+a-z0-9A-Z_-]{0,63}$/,_=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},v=n(85);i.prototype.parse=function(e,t,n){if(!a.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),r=-1!==i&&i<e.indexOf("#")?"?":"#",l=e.split(r);l[0]=l[0].replace(/\\/g,"/");var u=e=l.join(r);if(u=u.trim(),!n&&1===e.split("#").length){var b=c.exec(u);if(b)return this.path=u,this.href=u,this.pathname=b[1],b[2]?(this.search=b[2],this.query=t?v.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var k=s.exec(u);if(k){var w=(k=k[0]).toLowerCase();this.protocol=w,u=u.substr(k.length)}if(n||k||u.match(/^\/\/[^@\/]+@[^@\/]+/)){var O="//"===u.substr(0,2);!O||k&&y[k]||(u=u.substr(2),this.slashes=!0)}if(!y[k]&&(O||k&&!g[k])){for(var E,S,P=-1,C=0;C<d.length;C++)-1!==(x=u.indexOf(d[C]))&&(-1===P||x<P)&&(P=x);for(-1!==(S=-1===P?u.lastIndexOf("@"):u.lastIndexOf("@",P))&&(E=u.slice(0,S),u=u.slice(S+1),this.auth=decodeURIComponent(E)),P=-1,C=0;C<p.length;C++){var x;-1!==(x=u.indexOf(p[C]))&&(-1===P||x<P)&&(P=x)}-1===P&&(P=u.length),this.host=u.slice(0,P),u=u.slice(P),this.parseHost(),this.hostname=this.hostname||"";var j="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!j)for(var M=this.hostname.split(/\./),R=(C=0,M.length);C<R;C++){var T=M[C];if(T&&!T.match(h)){for(var B="",D=0,F=T.length;D<F;D++)T.charCodeAt(D)>127?B+="x":B+=T[D];if(!B.match(h)){var I=M.slice(0,C),A=M.slice(C+1),z=T.match(_);z&&(I.push(z[1]),A.unshift(z[2])),A.length&&(u="/"+A.join(".")+u),this.hostname=I.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),j||(this.hostname=o.toASCII(this.hostname));var L=this.port?":"+this.port:"",N=this.hostname||"";this.host=N+L,this.href+=this.host,j&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==u[0]&&(u="/"+u))}if(!m[w])for(C=0,R=f.length;C<R;C++){var U=f[C];if(-1!==u.indexOf(U)){var V=encodeURIComponent(U);V===U&&(V=escape(U)),u=u.split(U).join(V)}}var W=u.indexOf("#");-1!==W&&(this.hash=u.substr(W),u=u.slice(0,W));var K=u.indexOf("?");if(-1!==K?(this.search=u.substr(K),this.query=u.substr(K+1),t&&(this.query=v.parse(this.query)),u=u.slice(0,K)):t&&(this.search="",this.query={}),u&&(this.pathname=u),g[w]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){L=this.pathname||"";var H=this.search||"";this.path=L+H}return this.href=this.format(),this},i.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",n=this.pathname||"",i=this.hash||"",r=!1,o="";this.host?r=e+this.host:this.hostname&&(r=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(r+=":"+this.port)),this.query&&a.isObject(this.query)&&Object.keys(this.query).length&&(o=v.stringify(this.query));var s=this.search||o&&"?"+o||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||g[t])&&!1!==r?(r="//"+(r||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):r||(r=""),i&&"#"!==i.charAt(0)&&(i="#"+i),s&&"?"!==s.charAt(0)&&(s="?"+s),t+r+(n=n.replace(/[?#]/g,function(e){return encodeURIComponent(e)}))+(s=s.replace("#","%23"))+i},i.prototype.resolve=function(e){return this.resolveObject(r(e,!1,!0)).format()},i.prototype.resolveObject=function(e){if(a.isString(e)){var t=new i;t.parse(e,!1,!0),e=t}for(var n=new i,r=Object.keys(this),o=0;o<r.length;o++){var s=r[o];n[s]=this[s]}if(n.hash=e.hash,""===e.href)return n.href=n.format(),n;if(e.slashes&&!e.protocol){for(var l=Object.keys(e),c=0;c<l.length;c++){var u=l[c];"protocol"!==u&&(n[u]=e[u])}return g[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(e.protocol&&e.protocol!==n.protocol){if(!g[e.protocol]){for(var f=Object.keys(e),p=0;p<f.length;p++){var d=f[p];n[d]=e[d]}return n.href=n.format(),n}if(n.protocol=e.protocol,e.host||y[e.protocol])n.pathname=e.pathname;else{for(var h=(e.pathname||"").split("/");h.length&&!(e.host=h.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==h[0]&&h.unshift(""),h.length<2&&h.unshift(""),n.pathname=h.join("/")}if(n.search=e.search,n.query=e.query,n.host=e.host||"",n.auth=e.auth,n.hostname=e.hostname||e.host,n.port=e.port,n.pathname||n.search){var _=n.pathname||"",m=n.search||"";n.path=_+m}return n.slashes=n.slashes||e.slashes,n.href=n.format(),n}var v=n.pathname&&"/"===n.pathname.charAt(0),b=e.host||e.pathname&&"/"===e.pathname.charAt(0),k=b||v||n.host&&e.pathname,w=k,O=n.pathname&&n.pathname.split("/")||[],E=(h=e.pathname&&e.pathname.split("/")||[],n.protocol&&!g[n.protocol]);if(E&&(n.hostname="",n.port=null,n.host&&(""===O[0]?O[0]=n.host:O.unshift(n.host)),n.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===h[0]?h[0]=e.host:h.unshift(e.host)),e.host=null),k=k&&(""===h[0]||""===O[0])),b)n.host=e.host||""===e.host?e.host:n.host,n.hostname=e.hostname||""===e.hostname?e.hostname:n.hostname,n.search=e.search,n.query=e.query,O=h;else if(h.length)O||(O=[]),O.pop(),O=O.concat(h),n.search=e.search,n.query=e.query;else if(!a.isNullOrUndefined(e.search))return E&&(n.hostname=n.host=O.shift(),(j=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=j.shift(),n.host=n.hostname=j.shift())),n.search=e.search,n.query=e.query,a.isNull(n.pathname)&&a.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!O.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var S=O.slice(-1)[0],P=(n.host||e.host||O.length>1)&&("."===S||".."===S)||""===S,C=0,x=O.length;x>=0;x--)"."===(S=O[x])?O.splice(x,1):".."===S?(O.splice(x,1),C++):C&&(O.splice(x,1),C--);if(!k&&!w)for(;C--;C)O.unshift("..");!k||""===O[0]||O[0]&&"/"===O[0].charAt(0)||O.unshift(""),P&&"/"!==O.join("/").substr(-1)&&O.push("");var j,M=""===O[0]||O[0]&&"/"===O[0].charAt(0);return E&&(n.hostname=n.host=M?"":O.length?O.shift():"",(j=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=j.shift(),n.host=n.hostname=j.shift())),(k=k||n.host&&O.length)&&!M&&O.unshift(""),O.length?n.pathname=O.join("/"):(n.pathname=null,n.path=null),a.isNull(n.pathname)&&a.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},i.prototype.parseHost=function(){var e=this.host,t=l.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){(function(e,i){var r;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(i){function o(e){throw new RangeError(x[e])}function a(e,t){for(var n=e.length,i=[];n--;)i[n]=t(e[n]);return i}function s(e,t){var n=e.split("@"),i="";return n.length>1&&(i=n[0]+"@",e=n[1]),i+a((e=e.replace(C,".")).split("."),t).join(".")}function l(e){for(var t,n,i=[],r=0,o=e.length;r<o;)(t=e.charCodeAt(r++))>=55296&&t<=56319&&r<o?56320==(64512&(n=e.charCodeAt(r++)))?i.push(((1023&t)<<10)+(1023&n)+65536):(i.push(t),r--):i.push(t);return i}function c(e){return a(e,function(e){var t="";return e>65535&&(t+=R((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=R(e)}).join("")}function u(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:y}function f(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function p(e,t,n){var i=0;for(e=n?M(e/k):e>>1,e+=M(e/t);e>j*v>>1;i+=y)e=M(e/j);return M(i+(j+1)*e/(e+b))}function d(e){var t,n,i,r,a,s,l,f,d,h,_=[],b=e.length,k=0,S=O,P=w;for((n=e.lastIndexOf(E))<0&&(n=0),i=0;i<n;++i)e.charCodeAt(i)>=128&&o("not-basic"),_.push(e.charCodeAt(i));for(r=n>0?n+1:0;r<b;){for(a=k,s=1,l=y;r>=b&&o("invalid-input"),((f=u(e.charCodeAt(r++)))>=y||f>M((m-k)/s))&&o("overflow"),k+=f*s,!(f<(d=l<=P?g:l>=P+v?v:l-P));l+=y)s>M(m/(h=y-d))&&o("overflow"),s*=h;P=p(k-a,t=_.length+1,0==a),M(k/t)>m-S&&o("overflow"),S+=M(k/t),k%=t,_.splice(k++,0,S)}return c(_)}function h(e){var t,n,i,r,a,s,c,u,d,h,_,b,k,S,P,C=[];for(b=(e=l(e)).length,t=O,n=0,a=w,s=0;s<b;++s)(_=e[s])<128&&C.push(R(_));for(i=r=C.length,r&&C.push(E);i<b;){for(c=m,s=0;s<b;++s)(_=e[s])>=t&&_<c&&(c=_);for(c-t>M((m-n)/(k=i+1))&&o("overflow"),n+=(c-t)*k,t=c,s=0;s<b;++s)if((_=e[s])<t&&++n>m&&o("overflow"),_==t){for(u=n,d=y;!(u<(h=d<=a?g:d>=a+v?v:d-a));d+=y)P=u-h,S=y-h,C.push(R(f(h+P%S,0))),u=M(P/S);C.push(R(f(u,0))),a=p(n,k,i==r),n=0,++i}++n,++t}return C.join("")}"object"==typeof t&&t&&t.nodeType,"object"==typeof e&&e&&e.nodeType;var _,m=2147483647,y=36,g=1,v=26,b=38,k=700,w=72,O=128,E="-",S=/^xn--/,P=/[^\x20-\x7E]/,C=/[\x2E\u3002\uFF0E\uFF61]/g,x={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},j=y-g,M=Math.floor,R=String.fromCharCode;_={version:"1.4.1",ucs2:{decode:l,encode:c},decode:d,encode:h,toASCII:function(e){return s(e,function(e){return P.test(e)?"xn--"+h(e):e})},toUnicode:function(e){return s(e,function(e){return S.test(e)?d(e.slice(4).toLowerCase()):e})}},void 0===(r=function(){return _}.call(t,n,t,e))||(e.exports=r)}()}).call(t,n(83)(e),n(8))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";t.decode=t.parse=n(86),t.encode=t.stringify=n(87)},function(e,t,n){"use strict";function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,o){t=t||"&",n=n||"=";var a={};if("string"!=typeof e||0===e.length)return a;var s=/\+/g;e=e.split(t);var l=1e3;o&&"number"==typeof o.maxKeys&&(l=o.maxKeys);var c=e.length;l>0&&c>l&&(c=l);for(var u=0;u<c;++u){var f,p,d,h,_=e[u].replace(s,"%20"),m=_.indexOf(n);m>=0?(f=_.substr(0,m),p=_.substr(m+1)):(f=_,p=""),d=decodeURIComponent(f),h=decodeURIComponent(p),i(a,d)?r(a[d])?a[d].push(h):a[d]=[a[d],h]:a[d]=h}return a};var r=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";function i(e,t){if(e.map)return e.map(t);for(var n=[],i=0;i<e.length;i++)n.push(t(e[i],i));return n}var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,s){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?i(a(e),function(a){var s=encodeURIComponent(r(a))+n;return o(e[a])?i(e[a],function(e){return s+encodeURIComponent(r(e))}).join(t):s+encodeURIComponent(r(e[a]))}).join(t):s?encodeURIComponent(r(s))+n+encodeURIComponent(r(e)):""};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},a=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}},function(e,t){e.exports={"pesdk.adjustments.text.brightness":"controls.adjustments.brightness","pesdk.adjustments.text.clarity":"controls.adjustments.clarity","pesdk.adjustments.text.contrast":"controls.adjustments.contrast","pesdk.adjustments.text.exposure":"controls.adjustments.exposure","pesdk.adjustments.text.gamma":"controls.adjustments.gamma","pesdk.adjustments.text.highlights":"controls.adjustments.highlights","pesdk.adjustments.text.saturation":"controls.adjustments.saturation","pesdk.adjustments.text.shadows":"controls.adjustments.shadows","pesdk.adjustments.title.name":"controls.overview.adjustments","pesdk.brush.text.size":"controls.brush.size","pesdk.brush.title.name":"controls.overview.brush","pesdk.camera.text.webcamUnavailable":"errors.webcamUnavailable.text","pesdk.camera.title.headline":"webcam.headline","pesdk.common.button.back":"generic.back","pesdk.common.button.cancel":"generic.cancel","pesdk.common.text.color":"generic.color","pesdk.common.text.imageLoadFailed":"errors.imageLoadFailed.text","pesdk.common.text.loading":"loading.loading","pesdk.common.title.error":"errors.title","pesdk.common.title.imageLoadFailed":"errors.imageLoadFailed.title","pesdk.editor.button.backgroundImage":"editor.backgroundImage","pesdk.editor.button.export":"editor.export","pesdk.editor.button.new":"editor.new","pesdk.editor.button.undo":"editor.undo","pesdk.editor.text.exporting":"loading.exporting","pesdk.editor.text.imageResized_maxDimensions":"warning.imageResized_maxDimensions.text","pesdk.editor.text.imageResized_maxMegaPixels":"warning.imageResized_maxMegaPixels.text","pesdk.editor.text.invalidFileType":"errors.invalidFileType.text","pesdk.editor.text.renderingError":"error.renderingError.text","pesdk.editor.text.resizing":"loading.resizing","pesdk.editor.title.imageResized_maxDimensions":"warnings.imageResized_maxDimensions.title","pesdk.editor.title.imageResized_maxMegaPixels":"warnings.imageResized_maxMegaPixels.title","pesdk.editor.title.renderingError":"errors.renderingError.title","pesdk.editor.title.zoom":"editor.zoom","pesdk.filter.asset.all":"controls.filter.categories.all","pesdk.filter.asset.identity":"controls.filter.filters.identity","pesdk.filter.asset.imgly_filters_analog":"controls.filter.categories.imgly_filters_analog","pesdk.filter.asset.imgly_filters_bw":"controls.filter.categories.imgly_filters_bw","pesdk.filter.asset.imgly_filters_retro":"controls.filter.categories.imgly_filters_retro","pesdk.filter.asset.imgly_filters_special":"controls.filter.categories.imgly_filters_special","pesdk.filter.asset.imgly_filters_summer":"controls.filter.categories.imgly_filters_summer","pesdk.filter.asset.imgly_filters_winter":"controls.filter.categories.imgly_filters_winter","pesdk.filter.asset.imgly_lut_ad1920":"controls.filter.filters.imgly_lut_ad1920","pesdk.filter.asset.imgly_lut_ancient":"controls.filter.filters.imgly_lut_ancient","pesdk.filter.asset.imgly_lut_bleached":"controls.filter.filters.imgly_lut_bleached","pesdk.filter.asset.imgly_lut_bleachedblue":"controls.filter.filters.imgly_lut_bleachedblue","pesdk.filter.asset.imgly_lut_blues":"controls.filter.filters.imgly_lut_blues","pesdk.filter.asset.imgly_lut_blueshadows":"controls.filter.filters.imgly_lut_blueshadows","pesdk.filter.asset.imgly_lut_breeze":"controls.filter.filters.imgly_lut_breeze","pesdk.filter.asset.imgly_lut_bw":"controls.filter.filters.imgly_lut_bw","pesdk.filter.asset.imgly_lut_celsius":"controls.filter.filters.imgly_lut_celsius","pesdk.filter.asset.imgly_lut_chest":"controls.filter.filters.imgly_lut_chest","pesdk.filter.asset.imgly_lut_classic":"controls.filter.filters.imgly_lut_classic","pesdk.filter.asset.imgly_lut_colorful":"controls.filter.filters.imgly_lut_colorful","pesdk.filter.asset.imgly_lut_cool":"controls.filter.filters.imgly_lut_cool","pesdk.filter.asset.imgly_lut_cottoncandy":"controls.filter.filters.imgly_lut_cottoncandy","pesdk.filter.asset.imgly_lut_creamy":"controls.filter.filters.imgly_lut_creamy","pesdk.filter.asset.imgly_lut_eighties":"controls.filter.filters.imgly_lut_eighties","pesdk.filter.asset.imgly_lut_elder":"controls.filter.filters.imgly_lut_elder","pesdk.filter.asset.imgly_lut_evening":"controls.filter.filters.imgly_lut_evening","pesdk.filter.asset.imgly_lut_fall":"controls.filter.filters.imgly_lut_fall","pesdk.filter.asset.imgly_lut_fixie":"controls.filter.filters.imgly_lut_fixie","pesdk.filter.asset.imgly_lut_food":"controls.filter.filters.imgly_lut_food","pesdk.filter.asset.imgly_lut_fridge":"controls.filter.filters.imgly_lut_fridge","pesdk.filter.asset.imgly_lut_front":"controls.filter.filters.imgly_lut_front","pesdk.filter.asset.imgly_lut_glam":"controls.filter.filters.imgly_lut_glam","pesdk.filter.asset.imgly_lut_gobblin":"controls.filter.filters.imgly_lut_gobblin","pesdk.filter.asset.imgly_lut_highcarb":"controls.filter.filters.imgly_lut_highcarb","pesdk.filter.asset.imgly_lut_highcontrast":"controls.filter.filters.imgly_lut_highcontrast","pesdk.filter.asset.imgly_lut_k1":"controls.filter.filters.imgly_lut_k1","pesdk.filter.asset.imgly_lut_k2":"controls.filter.filters.imgly_lut_k2","pesdk.filter.asset.imgly_lut_k6":"controls.filter.filters.imgly_lut_k6","pesdk.filter.asset.imgly_lut_kdynamic":"controls.filter.filters.imgly_lut_kdynamic","pesdk.filter.asset.imgly_lut_keen":"controls.filter.filters.imgly_lut_keen","pesdk.filter.asset.imgly_lut_lenin":"controls.filter.filters.imgly_lut_lenin","pesdk.filter.asset.imgly_lut_litho":"controls.filter.filters.imgly_lut_litho","pesdk.filter.asset.imgly_lut_lomo100":"controls.filter.filters.imgly_lut_lomo100","pesdk.filter.asset.imgly_lut_lucid":"controls.filter.filters.imgly_lut_lucid","pesdk.filter.asset.imgly_lut_mellow":"controls.filter.filters.imgly_lut_mellow","pesdk.filter.asset.imgly_lut_neat":"controls.filter.filters.imgly_lut_neat","pesdk.filter.asset.imgly_lut_nogreen":"controls.filter.filters.imgly_lut_nogreen","pesdk.filter.asset.imgly_lut_orchid":"controls.filter.filters.imgly_lut_orchid","pesdk.filter.asset.imgly_lut_pale":"controls.filter.filters.imgly_lut_pale","pesdk.filter.asset.imgly_lut_pitched":"controls.filter.filters.imgly_lut_pitched","pesdk.filter.asset.imgly_lut_plate":"controls.filter.filters.imgly_lut_plate","pesdk.filter.asset.imgly_lut_pola669":"controls.filter.filters.imgly_lut_pola669","pesdk.filter.asset.imgly_lut_polasx":"controls.filter.filters.imgly_lut_polasx","pesdk.filter.asset.imgly_lut_pro400":"controls.filter.filters.imgly_lut_pro400","pesdk.filter.asset.imgly_lut_quozi":"controls.filter.filters.imgly_lut_quozi","pesdk.filter.asset.imgly_lut_sepiahigh":"controls.filter.filters.imgly_lut_sepiahigh","pesdk.filter.asset.imgly_lut_settled":"controls.filter.filters.imgly_lut_settled","pesdk.filter.asset.imgly_lut_seventies":"controls.filter.filters.imgly_lut_seventies","pesdk.filter.asset.imgly_lut_sin":"controls.filter.filters.imgly_lut_sin","pesdk.filter.asset.imgly_lut_soft":"controls.filter.filters.imgly_lut_soft","pesdk.filter.asset.imgly_lut_steel":"controls.filter.filters.imgly_lut_steel","pesdk.filter.asset.imgly_lut_summer":"controls.filter.filters.imgly_lut_summer","pesdk.filter.asset.imgly_lut_sunset":"controls.filter.filters.imgly_lut_sunset","pesdk.filter.asset.imgly_lut_tender":"controls.filter.filters.imgly_lut_tender","pesdk.filter.asset.imgly_lut_texas":"controls.filter.filters.imgly_lut_texas","pesdk.filter.asset.imgly_lut_twilight":"controls.filter.filters.imgly_lut_twilight","pesdk.filter.asset.imgly_lut_winter":"controls.filter.filters.imgly_lut_winter","pesdk.filter.asset.imgly_lut_x400":"controls.filter.filters.imgly_lut_x400","pesdk.filter.text.intensity":"controls.filter.intensity","pesdk.filter.title.name":"controls.overview.filters","pesdk.focus.button.mirrored":"controls.focus.mirrored","pesdk.focus.button.none":"controls.focus.none","pesdk.focus.button.radial":"controls.focus.radial","pesdk.focus.text.blurRadius":"controls.focus.blurRadius","pesdk.focus.title.name":"controls.overview.focus","pesdk.frame.asset.imgly_frame_art_decor":"controls.frame.frames.imgly_frame_art_decor","pesdk.frame.asset.imgly_frame_black_passepartout":"controls.frame.frames.imgly_frame_black_passepartout","pesdk.frame.asset.imgly_frame_dia":"controls.frame.frames.imgly_frame_dia","pesdk.frame.asset.imgly_frame_lowpoly_shadow":"controls.frame.frames.imgly_frame_lowpoly_shadow","pesdk.frame.asset.imgly_frame_wood_passepartout":"controls.frame.frames.imgly_frame_wood_passepartout","pesdk.frame.button.none":"controls.frame.noFrame","pesdk.frame.text.scale":"controls.frame.scale","pesdk.frame.title.name":"controls.overview.frame","pesdk.library.placeholder.search":"photoRoll.search.placeholder","pesdk.library.text.noSearchResults":"photoRoll.search.noSearchResults","pesdk.library.text.photoRollLoadFail":"errors.photoRollLoadFail.text","pesdk.library.title.photoRollLoadFail":"errors.photoRollLoadFail.title","pesdk.library.title.seachResults":"photoRoll.search.results.headline","pesdk.splash.button.upload":"splash.upload.button","pesdk.splash.text.photoRoll":"splash.photoRoll.description","pesdk.splash.text.upload":"splash.upload.description","pesdk.splash.text.webcam":"splash.webcam.description","pesdk.splash.title.photoRoll":"splash.photoRoll.headline","pesdk.splash.title.webcam":"splash.webcam.headline","pesdk.sticker.asset.imgly_sticker_emoticons":"controls.sticker.categories.imgly_sticker_emoticons","pesdk.sticker.asset.imgly_sticker_shapes":"controls.sticker.categories.imgly_sticker_shapes","pesdk.sticker.title.loadingStickersFailed":"errors.loadingStickersFailed.title","pesdk.sticker.title.name":"controls.overview.sticker","pesdk.text.button.alignment":"controls.text.alignment","pesdk.text.button.background":"controls.text.background","pesdk.text.button.font":"controls.text.font","pesdk.text.button.foreground":"controls.text.foreground","pesdk.text.button.size":"controls.text.size","pesdk.text.button.takeToFront":"controls.text.takeToFront","pesdk.text.placeholder.defaultText":"controls.text.defaultText","pesdk.text.text.loadingFontsFailed":"errors.loadingFontsFailed.text","pesdk.text.title.loadingFontsFailed":"errors.loadingFontsFailed.title","pesdk.text.title.name":"controls.overview.text","pesdk.transform.asset.imgly_transform_common_16-9":"controls.transform.ratios.imgly_transform_common_16-9","pesdk.transform.asset.imgly_transform_common_4-3":"controls.transform.ratios.imgly_transform_common_4-3","pesdk.transform.asset.imgly_transform_common_custom":"controls.transform.ratios.imgly_transform_common_custom","pesdk.transform.asset.imgly_transform_common_square":"controls.transform.ratios.imgly_transform_common_square","pesdk.transform.asset.imgly_transform_facebook_ad":"controls.transform.ratios.imgly_transform_facebook_ad","pesdk.transform.asset.imgly_transform_facebook_cover":"controls.transform.ratios.imgly_transform_facebook_cover","pesdk.transform.asset.imgly_transform_facebook_post":"controls.transform.ratios.imgly_transform_facebook_post","pesdk.transform.asset.imgly_transform_facebook_profile":"controls.transform.ratios.imgly_transform_facebook_profile","pesdk.transform.button.none":"controls.transform.none","pesdk.transform.text.rotation":"controls.transform.rotation","pesdk.transform.title.name":"controls.overview.transform"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},r=function(e){return e&&e.__esModule?e:{default:e}}(n(5)),o=n(22);t.default={EVENTS:i({},o.Events,{HISTORY_BEFORE_UNDO:"history:before_undo",COLORPICKER_OPEN:"colorpicker:open"}),DEFAULTS:{TRANSFORM_RATIOS:[[{identifier:"imgly_transform_common_custom",defaultName:"Custom",ratio:"*",selected:!0},{identifier:"imgly_transform_common_square",defaultName:"Square",ratio:1},{identifier:"imgly_transform_common_4-3",defaultName:"4:3",ratio:1.33},{identifier:"imgly_transform_common_16-9",defaultName:"16:9",ratio:1.77}],[{identifier:"imgly_transform_facebook_profile",defaultName:"FB Profile",ratio:1},{identifier:"imgly_transform_facebook_ad",defaultName:"FB Ad",dimensions:{x:1200,y:627}},{identifier:"imgly_transform_facebook_post",defaultName:"FB Post",dimensions:{x:940,y:788}},{identifier:"imgly_transform_facebook_cover",defaultName:"FB Cover",dimensions:{x:851,y:315}}]],BRUSHES:[r.default.Operations.SpriteOperation.BrushSprite.Brushes.RadialBrush],FONTS:[{fontFamily:"Aleo",variations:[{identifier:"imgly_font_aleo_bold",fontWeight:"bold",provider:"file",filePath:"fonts/imgly_font_aleo_bold.woff",textMetrics:{unitsPerEm:2048,ascender:1919,descender:-409}}]},{fontFamily:"Amatic SC",variations:[{identifier:"imgly_font_amaticsc",fontWeight:"normal",provider:"file",filePath:"fonts/imgly_font_amaticsc.woff",textMetrics:{unitsPerEm:2048,ascender:2332,descender:-583}}]},{fontFamily:"Bernier",variations:[{identifier:"imgly_font_bernier_regular",fontWeight:"normal",provider:"file",filePath:"fonts/imgly_font_bernier_regular.woff",textMetrics:{unitsPerEm:2048,ascender:2007,descender:-552}}]},{fontFamily:"Cheque",variations:[{identifier:"imgly_font_cheque_regular",fontWeight:"normal",provider:"file",filePath:"fonts/imgly_font_cheque_regular.woff",textMetrics:{unitsPerEm:2048,ascender:1853,descender:-495}}]},{fontFamily:"Open Sans",variations:[{identifier:"imgly_font_open_sans_bold",fontWeight:"bold",provider:"file",filePath:"fonts/imgly_font_open_sans_bold.woff",default:!0,textMetrics:{unitsPerEm:2048,ascender:2189,descender:-640}}]},{fontFamily:"Gagalin",variations:[{identifier:"imgly_font_gagalin_regular",fontWeight:"normal",provider:"file",filePath:"fonts/imgly_font_gagalin_regular.woff",textMetrics:{unitsPerEm:2048,ascender:1987,descender:-628}}]},{fontFamily:"Hagin",variations:[{identifier:"imgly_font_hagin_caps_thin",fontWeight:200,provider:"file",filePath:"fonts/imgly_font_hagin_caps_thin.woff",textMetrics:{unitsPerEm:2048,ascender:1964,descender:-482}}]},{fontFamily:"Intro",variations:[{identifier:"imgly_font_intro_inline",fontWeight:"normal",provider:"file",filePath:"fonts/imgly_font_intro_inline.woff",textMetrics:{unitsPerEm:2048,ascender:1944,descender:-548}}]},{fontFamily:"Lobster",variations:[{identifier:"imgly_font_lobster",fontWeight:"normal",provider:"file",filePath:"fonts/imgly_font_lobster.woff",textMetrics:{unitsPerEm:2048,ascender:2048,descender:-552}}]},{fontFamily:"Nexa",variations:[{identifier:"imgly_font_nexa_script",fontWeight:"normal",provider:"file",filePath:"fonts/imgly_font_nexa_script.woff",textMetrics:{unitsPerEm:2048,ascender:1835,descender:-663}}]},{fontFamily:"Ostrich",variations:[{identifier:"imgly_font_ostrich_sans_black",fontWeight:800,provider:"file",filePath:"fonts/imgly_font_ostrich_sans_black.woff",textMetrics:{unitsPerEm:2048,ascender:1513,descender:-235}},{identifier:"imgly_font_ostrich_sans_bold",fontWeight:"bold",provider:"file",filePath:"fonts/imgly_font_ostrich_sans_bold.woff",textMetrics:{unitsPerEm:2048,ascender:1513,descender:-235}}]},{fontFamily:"Panton",variations:[{identifier:"imgly_font_panton_black_italic_caps",fontWeight:800,fontStyle:"italic",provider:"file",filePath:"fonts/imgly_font_panton_blackitalic_caps.woff",textMetrics:{unitsPerEm:2048,ascender:2033,descender:-572}},{identifier:"imgly_font_panton_light_italic_caps",fontWeight:200,fontStyle:"italic",provider:"file",filePath:"fonts/imgly_font_panton_lightitalic_caps.woff",textMetrics:{unitsPerEm:2048,ascender:1961,descender:-556}}]},{fontFamily:"Perfograma",variations:[{identifier:"imgly_font_perfograma",fontWeight:"normal",provider:"file",filePath:"fonts/imgly_font_perfograma.woff",textMetrics:{unitsPerEm:2048,ascender:1982,descender:-842}}]},{fontFamily:"Trashhand",variations:[{identifier:"imgly_font_trash_hand",fontWeight:"normal",provider:"file",filePath:"fonts/imgly_font_trash_hand.woff",textMetrics:{unitsPerEm:2048,ascender:1554,descender:-663}}]}]}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=[{defaultName:"Natasha Wescoat",identifier:"imgly_art_filter_june_tree",rootPath:"art-filters/imgly_june_tree",thumbnail:"art-filters/imgly_june_tree/thumbnail.jpg"},{defaultName:"Hive",identifier:"imgly_art_filter_hive",rootPath:"art-filters/imgly_hive",thumbnail:"art-filters/imgly_hive/thumbnail.jpg"},{defaultName:"Udnie",identifier:"imgly_art_filter_udnie",rootPath:"art-filters/imgly_udnie",thumbnail:"art-filters/imgly_udnie/thumbnail.jpg"},{defaultName:"Vince Low",identifier:"imgly_art_filter_vince_low",rootPath:"art-filters/imgly_vince_low",thumbnail:"art-filters/imgly_vince_low/thumbnail.jpg"},{defaultName:"Mosaic",identifier:"imgly_art_filter_mosaic",rootPath:"art-filters/imgly_mosaic",thumbnail:"art-filters/imgly_mosaic/thumbnail.jpg"},{defaultName:"Wave",identifier:"imgly_art_filter_wave",rootPath:"art-filters/imgly_wave",thumbnail:"art-filters/imgly_wave/thumbnail.jpg"},{defaultName:"Malikova Darya",identifier:"imgly_art_filter_watercolor",rootPath:"art-filters/imgly_watercolor",thumbnail:"art-filters/imgly_watercolor/thumbnail.jpg"}]},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function(e){return e&&e.__esModule?e:{default:e}}(n(5)),a=o.default.EventEmitter,s=o.default.Utils,l=o.default.Log,c=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n._state=e,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a),r(t,[{key:"set",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];"object"!==(void 0===e?"undefined":i(e))&&l.warn("SharedState#set expects an object as first parameter");var n=s.extend({},this._state);this._state=s.extend(this._state,e),t&&this.broadcastUpdate(n,this._state)}},{key:"get",value:function(e){return this._state[e]}},{key:"broadcastUpdate",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.emit("update",e,t)}},{key:"clear",value:function(){this._state={}}}]),t}();t.default=c},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});for(/*
 * http://paulirish.com/2011/requestanimationframe-for-smart-animating/
 * http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
 * requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
 * MIT license
 * @license
 */
var n="undefined"==typeof window?e:window,i=n.requestAnimationFrame,r=n.cancelAnimationFrame,o=0,a=["ms","moz","webkit","o"],s=0;s<a.length&&!i;++s)t.requestAnimationFrame=i=n[a[s]+"RequestAnimationFrame"],t.cancelAnimationFrame=r=n[a[s]+"CancelAnimationFrame"]||n[a[s]+"CancelRequestAnimationFrame"];i&&(t.requestAnimationFrame=i=i.bind(n)),r&&(t.cancelAnimationFrame=r=r.bind(n)),i||(t.requestAnimationFrame=i=function(e,t){var n=(new Date).getTime(),i=Math.max(0,16-(n-o)),r=setTimeout(function(){e(n+i)},i);return o=n+i,r}),r||(t.cancelAnimationFrame=r=function(e){clearTimeout(e)}),t.requestAnimationFrame=i,t.cancelAnimationFrame=r}).call(t,n(8))},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(94)),s=i(n(96)),l=i(n(103)),c=i(n(113)),u=i(n(116)),f=i(n(10)),p=i(n(204)),d=i(n(1)),h=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var p=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));p._onScreenMounted=function(e,t){p._screenElements[e+"Screen"]=t,"editor"!==e||p._isReady||(p._isReady=!0,p.props.mediator.emit(o.Constants.EVENTS.EDITOR_READY))},p._screens={loading:a.default,splash:s.default,photoRoll:l.default,webcam:c.default,editor:u.default,empty:f.default};var d=void 0;return p.props.options.preloader&&(d="loading"),p._screenAfterLoading="splash",p.props.options.editor.image&&(p._screenAfterLoading="editor"),d||(d=p._screenAfterLoading),p._screenElements={},p._isReady=!1,p._previousScreensStack=[],p.state={activeScreen:p._screens[d],activeScreenName:d,screens:function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},d,p._screens[d])},p}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.React.Component),r(t,[{key:"hasPreviousScreen",value:function(){return!!this._previousScreensStack.length}},{key:"getPreviousScreen",value:function(){var e=this._previousScreensStack;return e[e.length-1]}},{key:"switchToScreen",value:function(e){var t=this,n=null;if("back"===e){if(!(n=this._previousScreensStack.pop()))throw new Error("Unable to switch to previous screen - no previous screen found.")}else{if("post-loading"===e&&(e=this._screenAfterLoading),!(n=this._screens[e]))throw new Error("Unknown screen `"+e+"`");this._previousScreensStack.push(this.state.activeScreen)}return this.state.screens[e]||(this.state.screens[e]=n),"editor"!==this.state.activeScreenName&&delete this.state.screens[this.state.activeScreenName],new o.Promise(function(i){t.setState({activeScreen:n,activeScreenName:e},function(){i()})})}},{key:"setImage",value:function(e,t){var n=this;this.props.options.editor.image=e;var i=!this._screenElements.editorScreen;this.switchToScreen("editor").then(function(){i||n._screenElements.editorScreen.setImage(e,t)})}},{key:"export",value:function(){return this.state.activeScreen!==this._screens.editor?o.Promise.reject(new Error("Unable to export: Active screen is not the editor screen.")):this.state.screens.editor?(e=this._screenElements.editorScreen).export.apply(e,arguments):void 0;var e}},{key:"getEditor",value:function(){return this.state.activeScreen!==this._screens.editor?o.Promise.reject(new Error("Unable to get editor: Active screen is not the editor screen.")):this.state.screens.editor?this._screenElements.editorScreen.getEditor():void 0}},{key:"serialize",value:function(){var e;return this.state.screens.editor?(e=this._screenElements.editorScreen).serialize.apply(e,arguments):o.Promise.reject(new Error("Editor screen unavailable"))}},{key:"deserialize",value:function(e){return this.state.screens.editor?this._screenElements.editorScreen.deserialize(e):o.Promise.reject(new Error("Editor screen unavailable"))}},{key:"getChildContext",value:function(){return{ui:this.props.ui,options:this.props.options,mediator:this.props.mediator,globalState:this.props.globalState}}},{key:"_renderScreens",value:function(){var e=this,t=[];for(var n in this.state.screens)!function(n){var i=e.state.screens[n],r=e.state.activeScreen===i;t.push(o.ReactBEM.createElement(i,{ref:function(t){return e._onScreenMounted(n,t)},app:e,visible:r}))}(n);return t}},{key:"render",value:function(){return o.ReactBEM.transform(o.ReactBEM.createElement("div",{bem:"b:editor"},o.ReactBEM.createElement(p.default,{modalManager:d.default.instance}),this._renderScreens()))}}]),t}();t.default=h,h.childContextTypes={ui:o.PropTypes.object.isRequired,mediator:o.PropTypes.object.isRequired,options:o.PropTypes.object.isRequired,globalState:o.PropTypes.object.isRequired},h.propTypes={ui:o.PropTypes.object.isRequired,mediator:o.PropTypes.object.isRequired,options:o.PropTypes.object.isRequired,globalState:o.PropTypes.object.isRequired}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0},o=n(0),a=function(e){return e&&e.__esModule?e:{default:e}}(n(10)),s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o.state={progress:0},o._preloader=o.context.ui.getPreloader(),o._preloader.on("progress",function(e){o.state.progress=e}),o._preloader.on("done",function(){o.props.app.switchToScreen("post-loading")}),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),i(t,[{key:"componentDidMount",value:function(){var e=this;r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this);var n=window.devicePixelRatio;this._canvas=this.refs.canvas,this._canvas.width=this._canvas.offsetWidth*n,this._canvas.height=this._canvas.offsetHeight*n,this._context=this._canvas.getContext("2d"),this._preloaderImage=new window.Image,this._preloaderImage.addEventListener("load",function(){e._preloader.load(),(0,o.requestAnimationFrame)(e._tick)}),this._preloaderImage.crossOrigin="Anonymous",this._preloaderImage.src=this.context.ui.getAssetPath("preloader.png",!0),this._running=!0,this._tick=this._tick.bind(this)}},{key:"componentWillUnmount",value:function(){r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentWillUnmount",this).call(this),this._running=!1}},{key:"_tick",value:function(){this._renderLoadingIndicator(),this._running&&(0,o.requestAnimationFrame)(this._tick)}},{key:"_renderLoadingIndicator",value:function(){var e=this._canvas,t=e.width,n=e.height,i=this._context;i.clearRect(0,0,t,n),i.save(),i.beginPath(),i.moveTo(t/2,n/2),i.arc(t/2,n/2,t/2,.5*-Math.PI,2*Math.PI*this.state.progress-.5*Math.PI,!1),i.lineTo(t/2,n/2),i.clip(),i.drawImage(this._preloaderImage,0,0,this._preloaderImage.width,this._preloaderImage.height,0,0,t,n),i.restore(),i.save(),i.globalAlpha=.05,i.drawImage(this._preloaderImage,0,0,this._preloaderImage.width,this._preloaderImage.height,0,0,t,n),i.restore()}},{key:"_renderScreen",value:function(){return o.ReactBEM.createElement("div",{bem:"$b:loadingScreen"},o.ReactBEM.createElement("div",{bem:"e:container"},o.ReactBEM.createElement("canvas",{bem:"e:canvas",ref:"canvas"})))}}]),t}();t.default=s,s.contextTypes=o.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._bindAll("_onCloseClick"),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"_onCloseClick",value:function(){this.context.mediator.emit(r.Constants.EVENTS.CLOSE)}},{key:"renderWithBEM",value:function(){var e=void 0;return this.context.options.showCloseButton&&(e=r.ReactBEM.createElement("div",{bem:"$e:close",onClick:this._onCloseClick},r.ReactBEM.createElement("img",{bem:"e:image",src:this._getAssetPath("close.png",!0)}))),r.ReactBEM.createElement("div",{bem:"$b:header"},r.ReactBEM.createElement("div",{bem:"e:label"},this.context.options.title),e)}}]),t}();t.default=o,o.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(10)),s=i(n(97)),l=i(n(101)),c=i(n(102)),u=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e._bindAll("_onWebcamClick","_onPhotoRollClick","_onImage"),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),r(t,[{key:"_onPhotoRollClick",value:function(){this.props.app.switchToScreen("photoRoll")}},{key:"_onWebcamClick",value:function(){this.props.app.switchToScreen("webcam")}},{key:"_onImage",value:function(e){this.props.app.setImage(e)}},{key:"_isWebcamAvailable",value:function(){return!o.Utils.isMobile()&&!1!==this.context.options.enableWebcam}},{key:"_isPhotoRollAvailable",value:function(){return!!this.context.options.photoRoll.provider}},{key:"_renderScreen",value:function(){var e=[],t=0,n=this.context.options.enableUpload;n&&t++;var i=this._isWebcamAvailable();i&&t++;var r=this._isPhotoRollAvailable();return r&&t++,n&&e.push(o.ReactBEM.createElement(s.default,{onImage:this._onImage,totalRows:t})),i&&e.push(o.ReactBEM.createElement(l.default,{onClick:this._onWebcamClick,totalRows:t})),r&&e.push(o.ReactBEM.createElement(c.default,{onClick:this._onPhotoRollClick,totalRows:t})),o.ReactBEM.createElement("div",{bem:"$b:splashScreen"},o.ReactBEM.createElement("div",{bem:"e:container"},e))}}]),t}();t.default=u,u.contextTypes=o.BaseComponent.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(0),s=i(n(1)),l=i(n(24)),c=i(n(98)),u=i(n(25)),f=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e._modifier="upload",e._bindAll("_onImage","_onDragEnter","_onDragOver","_onDragLeave","_onDrop"),e._dragCounter=0,e.state={dragAreaHovered:!1},e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l.default),o(t,[{key:"_onDragEnter",value:function(e){e.preventDefault(),this._dragCounter++,this.setState({dragAreaHovered:!0})}},{key:"_onDragOver",value:function(e){e.preventDefault()}},{key:"_onDragLeave",value:function(e){e.preventDefault(),0===--this._dragCounter&&this.setState({dragAreaHovered:!1})}},{key:"_onDrop",value:function(e){var t=this;e.stopPropagation(),e.preventDefault(),(e=e.nativeEvent).returnValue=!1,this.setState({dragAreaHovered:!1},function(){if(e.dataTransfer)return e.dataTransfer.files[0].type.match(/^image\//i)?void t._handleFile(e.dataTransfer.files[0]):s.default.instance.displayError(t._t("pesdk.common.title.error"),t._t("pesdk.editor.text.invalidFileType",{fileType:e.dataTransfer.files[0].type}))})}},{key:"_onClick",value:function(e){this.refs.upload.open()}},{key:"_handleFile",value:function(e){var t=this,n=new window.FileReader;n.onload=function(e){var n=e.target.result,i=new window.Image;i.addEventListener("load",function(){t._onImage(i)}),i.src=n},n.readAsDataURL(e)}},{key:"_onImage",value:function(e){this.props.onImage&&this.props.onImage(e)}},{key:"_renderContent",value:function(){var e={onDragEnter:this._onDragEnter,onDragOver:this._onDragOver,onDragLeave:this._onDragLeave,onDrop:this._onDrop};this.state.dragAreaHovered&&(e.className="is-hovered");var t="e:contentCell";return!1===this.context.options.enableWebcam&&null===this.context.options.photoRoll.provider||(t+=" m:withBorder"),a.ReactBEM.createElement("div",{bem:"e:contentWrapper"},a.ReactBEM.createElement("div",{bem:"e:contentRow"},a.ReactBEM.createElement("div",r({bem:t,onClick:this._onClick},e),a.ReactBEM.createElement(u.default,{ref:"upload",onNewFile:this._onImage}),a.ReactBEM.createElement(c.default,{bem:"e:button",uppercase:!0},this._t("pesdk.splash.button.upload")),a.ReactBEM.createElement("div",{bem:"e:description"},this._t("pesdk.splash.text.upload")))))}}]),t}();t.default=f,f.propTypes={onImage:a.PropTypes.func.isRequired},f.contextTypes=l.default.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"renderWithBEM",value:function(){var e="b:button";return this.props.uppercase&&(e+=" m:uppercase"),r.ReactBEM.createElement("button",{bem:e,className:this.props.className,onClick:this.props.onClick},this.props.children)}}]),t}();t.default=o,o.propTypes={onClick:r.PropTypes.func,children:r.PropTypes.any.isRequired,className:r.PropTypes.string},o.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(100)),a=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n._input=e,n._onFileChange=n._onFileChange.bind(n),n._input.addEventListener("change",n._onFileChange),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.EventEmitter),i(t,[{key:"open",value:function(){this._input.value=null,this._input.click()}},{key:"_handleFiles",value:function(e){var t=this,n=[],i=e.length,r=function(){0==(i-=1)&&t.emit("files",n)},a=!0,s=!1,l=void 0;try{for(var c,u=e[Symbol.iterator]();!(a=(c=u.next()).done);a=!0)!function(e){var i=new window.FileReader;i.onload=function(i){var a=i.target.result,s=new window.Image;s.addEventListener("load",function(){n.push({image:s,name:e.name||""}),r()}),s.addEventListener("error",function(e){return r(),o.default.instance.displayError(t._t("errors.title"),t._t("errors.imageLoadingError.text"))}),s.src=a},i.readAsDataURL(e)}(c.value)}catch(e){s=!0,l=e}finally{try{!a&&u.return&&u.return()}finally{if(s)throw l}}}},{key:"_onFileChange",value:function(){var e=this._input.files;e.length&&this._handleFiles(e)}},{key:"dispose",value:function(){this._input.removeEventListener("change",this._onFileChange)}}]),t}();t.default=a},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=n(0),l=function(e){function t(e,n,o){var a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],l=arguments.length>4&&void 0!==arguments[4]&&arguments[4];i(this,t);var c=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return c.id=s.SDKUtils.getUUID(),c.type=e,c.title=n,c.text=o,c.overlay=a,c.closeOnOverlayClick=l,c.visible=!0,c.data=null,c}return o(t,s.EventEmitter),a(t,[{key:"setData",value:function(e){this.data=e,this.emit("update")}},{key:"close",value:function(){this.visible=!1,this.emit("close")}},{key:"remove",value:function(){this.emit("remove")}}]),t}(),c=function(e){function t(){i(this,t);var e=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e._modals=[],e}return o(t,s.EventEmitter),a(t,[{key:"displayLoading",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=new l("loading",e,null,t);return this.addModal(n),n}},{key:"displayProgress",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=new l("progress",null,e,n);return i.setData({progress:t}),this.addModal(i),i}},{key:"displayInput",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=new l("input",e,null,n,!0);return i.setData({text:t}),this.addModal(i),i}},{key:"displayWarning",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:["OK"],i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],r=new l("warning",e,t,i);return r.setData({buttons:n}),this.addModal(r),r}},{key:"displayError",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=new l("error",e,t,n);return this.addModal(i),i}},{key:"addModal",value:function(e){var t=this;this._modals.push(e),e.on("close",function(){t.emit("update")}),e.on("remove",function(){t.removeModal(e)}),e.on("update",function(){t.emit("update")}),this.emit("update")}},{key:"removeModal",value:function(e){var t=this._modals.indexOf(e);this._modals.splice(t,1),this.emit("update")}},{key:"getModals",value:function(){return this._modals}}],[{key:"instance",get:function(){return this._instance||(this._instance=new t),this._instance}}]),t}();t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(24)),a=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._needsStyleFixes=!0,o._modifier="webcam",o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),i(t,[{key:"fixStyles",value:function(){if(r.Utils.Browser.isIElte(11)){var e=this.refs,t=e.cell,n=e.overlay,i=t.offsetHeight;n.style.height=i+"px"}}},{key:"_renderContent",value:function(){var e={backgroundImage:"url("+this._getAssetPath("splash/webcam.png",!0,!0)+")"};return r.ReactBEM.createElement("div",{bem:"e:contentWrapper"},r.ReactBEM.createElement("div",{bem:"e:contentRow"},r.ReactBEM.createElement("div",{bem:"e:contentCell",onClick:this._onClick,style:e,ref:"cell"},r.ReactBEM.createElement("div",{bem:"e:overlay",ref:"overlay"}),r.ReactBEM.createElement("div",{bem:"e:headline"},this._t("pesdk.splash.title.webcam")),r.ReactBEM.createElement("div",{bem:"e:description"},this._t("pesdk.splash.text.webcam")))))}}]),t}();t.default=a,a.contextTypes=o.default.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(24)),a=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._needsStyleFixes=!0,o._modifier="photoRoll",o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),i(t,[{key:"fixStyles",value:function(){if(r.Utils.Browser.isIElte(11)){var e=this.refs,t=e.cell,n=e.overlay,i=t.offsetHeight;n.style.height=i+"px"}}},{key:"_renderContent",value:function(){var e={backgroundImage:"url("+this._getAssetPath("splash/photo-roll.png",!0,!0)+")"};return r.ReactBEM.createElement("div",{bem:"e:contentWrapper"},r.ReactBEM.createElement("div",{bem:"e:contentRow"},r.ReactBEM.createElement("div",{bem:"e:contentCell",onClick:this._onClick,style:e,ref:"cell"},r.ReactBEM.createElement("div",{bem:"e:overlay",ref:"overlay"}),r.ReactBEM.createElement("div",{bem:"e:headline"},this._t("pesdk.splash.title.photoRoll")),r.ReactBEM.createElement("div",{bem:"e:description"},this._t("pesdk.splash.text.photoRoll")))))}}]),t}();t.default=a,a.contextTypes=o.default.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(10)),s=i(n(104)),l=i(n(108)),c=i(n(39)),u=i(n(111)),f=i(n(1)),p=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o.state={section:"overview",sectionsHistory:[]},o._bindAll("_onLibraryClicked","_onSearchSuggestionClicked","_onPhotoClicked","_onFileUpload","_onWebcamClick","_onBackClicked","_onSearch"),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),r(t,[{key:"hasPreviousSection",value:function(){return!!this.state.sectionsHistory.length}},{key:"switchToSection",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if("back"===e){if(!this.hasPreviousSection())return t?this.props.app.switchToScreen("back"):this.switchToSection("overview");e=this.state.sectionsHistory.pop()}else this.state.section!==e&&n&&this.state.sectionsHistory.push(this.state.section);this.setState({section:e})}},{key:"_onLibraryClicked",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.state.library=e,this.switchToSection("library",!0,!t)}},{key:"_onSearchSuggestionClicked",value:function(e){this.state.searchQuery=e.query,this.switchToSection("search")}},{key:"_onPhotoClicked",value:function(e){var t=this,n=f.default.instance.displayLoading(this._t("pesdk.common.text.loading")),i=new window.Image;i.addEventListener("load",function(){n.close(),t.props.app.setImage(i,!0)}),i.addEventListener("error",function(){n.close(),f.default.instance.displayError(t._t("pesdk.common.title.imageLoadFail"),t._t("pesdk.common.text.imageLoadFail",{path:i.src}))}),i.crossOrigin=o.SDKUtils.getCrossOriginValue(this.context.options.crossOrigin),i.src=e.urls.raw}},{key:"_onBackClicked",value:function(e){this.switchToSection("back"),e.preventDefault()}},{key:"_onSearch",value:function(e){if(!e.trim().length)return this.state.searchQuery=null,this.switchToSection("back",!1);this.state.searchQuery=e,this.switchToSection("search")}},{key:"_onWebcamClick",value:function(){this.props.app.switchToScreen("webcam")}},{key:"_onFileUpload",value:function(e){this.props.app.setImage(e)}},{key:"_isBackButtonVisible",value:function(){return 0!==this.state.sectionsHistory.length||this.props.app.hasPreviousScreen()}},{key:"_renderContent",value:function(){switch(this.state.section){case"search":return o.ReactBEM.createElement(u.default,{query:this.state.searchQuery,onPhotoClicked:this._onPhotoClicked,onSearchSuggestionClicked:this._onSearchSuggestionClicked});case"library":return o.ReactBEM.createElement(c.default,{crossOrigin:o.SDKUtils.getCrossOriginValue(this.context.options.crossOrigin),library:this.state.library,onPhotoClicked:this._onPhotoClicked});case"overview":return o.ReactBEM.createElement(l.default,{onLibraryClicked:this._onLibraryClicked,onSearchSuggestionClicked:this._onSearchSuggestionClicked})}}},{key:"_renderScreen",value:function(){var e=this._renderContent();return o.ReactBEM.createElement("div",{bem:"$b:photoRollScreen"},o.ReactBEM.createElement(s.default,{onBackClicked:this._onBackClicked,onSearch:this._onSearch,searchQuery:this.state.searchQuery,onFileUpload:this._onFileUpload,onWebcamClick:this._onWebcamClick,backButton:this._isBackButtonVisible(),backButtonLabel:this._t("pesdk.common.button.back"),ref:"topBarControls"}),e)}}]),t}();t.default=p,p.contextTypes=a.default.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(14)),s=i(n(105)),l=i(n(25)),c=i(n(106)),u=i(n(107)),f=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return a._bindAll("_onUploadButtonClicked","_onWebcamButtonClicked","_onBackClicked","_onSearchValueChange","_onNewFile"),a._onSearchValueChange=o.Utils.debounce(a._onSearchValueChange,250),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),r(t,[{key:"_onBackClicked",value:function(e){this.props.onBackClicked&&this.props.onBackClicked(),e.preventDefault()}},{key:"_onSearchValueChange",value:function(e){this.props.onSearch&&this.props.onSearch(e)}},{key:"_onUploadButtonClicked",value:function(){this.refs.upload.open()}},{key:"_onWebcamButtonClicked",value:function(){this.props.onWebcamClick&&this.props.onWebcamClick()}},{key:"_onNewFile",value:function(e){this.props.onFileUpload&&this.props.onFileUpload(e)}},{key:"_isWebcamAvailable",value:function(){return!o.Utils.isMobile()&&!1!==this.context.options.enableWebcam}},{key:"_renderRightButtons",value:function(){var e=[];return this.context.options.enableUpload&&e.push(o.ReactBEM.createElement(s.default,{icon:this._getAssetPath("photo-roll/upload.png",!0),onClick:this._onUploadButtonClicked})),this._isWebcamAvailable()&&e.push(o.ReactBEM.createElement(s.default,{icon:this._getAssetPath("photo-roll/webcam.png",!0),onClick:this._onWebcamButtonClicked})),e}},{key:"renderWithBEM",value:function(){var e=void 0;return this.props.backButton&&(e=o.ReactBEM.createElement(u.default,{label:this.props.backButtonLabel,onClick:this._onBackClicked})),o.ReactBEM.createElement("div",{bem:"$b:topBar e:row"},o.ReactBEM.createElement("div",{bem:"e:cell"},o.ReactBEM.createElement("div",{bem:"e:table"},o.ReactBEM.createElement("div",{bem:"e:cell m:left"},e),o.ReactBEM.createElement("div",{bem:"e:cell m:fullWidth"},o.ReactBEM.createElement(c.default,{searchQuery:this.props.searchQuery,onChange:this._onSearchValueChange}),o.ReactBEM.createElement(l.default,{onNewFile:this._onNewFile,ref:"upload"})),o.ReactBEM.createElement("div",{bem:"e:cell m:right"},this._renderRightButtons()))))}}]),t}();t.default=f,f.contextTypes=a.default.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"renderWithBEM",value:function(){return r.ReactBEM.createElement("bem",{specifier:"$b:topBar"},r.ReactBEM.createElement("div",{bem:"$e:iconButton",onClick:this.props.onClick},r.ReactBEM.createElement("img",{bem:"e:icon",src:this.props.icon})))}}]),t}();t.default=o,o.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._bindAll("_onFocus","_onBlur","_onChange","_onBarClick"),o.state={active:!1,placeholder:o._t("pesdk.library.placeholder.search"),value:o.props.searchQuery||""},o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"componentWillReceiveProps",value:function(e){e.searchQuery||this.state.value?this.state.active=!0:this.state.active=!1,this.setState({value:e.searchQuery||""})}},{key:"componentDidUpdate",value:function(){this.refs.input.value=this.state.value}},{key:"componentDidMount",value:function(){var e=this;(function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this),this._hiddenInputDummy=document.createElement("div");var n=r.Utils.getStyleObject(this.refs.input);["font","lineHeight","textAlign","textIndent","textTransform","textDecoration","textRendering","textShadow","textOverflow","wordSpacing","letterSpacing","whiteSpace"].forEach(function(t){e._hiddenInputDummy.style[t]=n[t]}),this._hiddenInputDummy.style.position="absolute",this._hiddenInputDummy.style.top="-9999px",this._hiddenInputDummy.style.left="-9999px",this.refs.root.appendChild(this._hiddenInputDummy)}},{key:"_onBarClick",value:function(){this.refs.input.focus()}},{key:"_onFocus",value:function(){this.setState({active:!0})}},{key:"_onBlur",value:function(){""!==this.state.value||this.props.searchQuery||this.setState({active:!1})}},{key:"_onChange",value:function(e){this.state.value=e.target.value,this.forceUpdate(),this.props.onChange&&this.props.onChange(this.state.value)}},{key:"renderWithBEM",value:function(){var e="$e:searchBar",t="photo-roll/search-light.png";return this.state.active&&(e+=" m:active",t="photo-roll/search-dark.png"),t=this._getAssetPath(t,!0),r.ReactBEM.createElement("bem",{specifier:"$b:photoRollScreen"},r.ReactBEM.createElement("div",{bem:e,ref:"root",onClick:this._onBarClick},r.ReactBEM.createElement("div",{bem:"e:content"},r.ReactBEM.createElement("div",{bem:"$e:icon"},r.ReactBEM.createElement("img",{src:t,bem:"e:image"})),r.ReactBEM.createElement("div",{bem:"e:inputContainer"},r.ReactBEM.createElement("input",{bem:"e:input",ref:"input",placeholder:this.state.placeholder,onBlur:this._onBlur,onFocus:this._onFocus,onChange:this._onChange,defaultValue:this.state.value,style:{width:"100%"}})))))}}]),t}();t.default=o,o.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"renderWithBEM",value:function(){return r.ReactBEM.createElement("bem",{specifier:"$b:topBar"},r.ReactBEM.createElement("div",{bem:"$e:backButton",onClick:this.props.onClick},r.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("top-bar/back.png",!0)}),r.ReactBEM.createElement("div",{bem:"e:label"},this.props.label)))}}]),t}();t.default=o,o.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{!i&&s.return&&s.return()}finally{if(r)throw o}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(0),s=i(n(1)),l=i(n(109)),c=i(n(38)),u=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));o._needsStyleFixes=!0,o.state={loading:!0,libraries:[],searchSuggestions:[]},o._bindAll("_onLibraryClick","_onSearchSuggestionClick");var a=o.context.options.photoRoll.provider;return o._provider=new a,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.BaseComponent),o(t,[{key:"fixStyles",value:function(){if(a.Utils.Browser.isIElte(11)){var e=this.refs,t=e.cell,n=e.container;if(!t||!n)return;var i=t.offsetHeight;n.style.height=i+"px"}}},{key:"componentDidMount",value:function(){var e=this;(function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this);var n=s.default.instance.displayLoading(this._t("pesdk.common.text.loading"));this._load().then(function(t){var i=r(t,2),o=i[0],a=i[1];n.close(),1===o.length?e._onLibraryClick(o[0],!0):e.setState({loading:!1,libraries:o,searchSuggestions:a})})}},{key:"_onLibraryClick",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.props.onLibraryClicked&&this.props.onLibraryClicked(e,t)}},{key:"_onSearchSuggestionClick",value:function(e){this.props.onSearchSuggestionClicked&&this.props.onSearchSuggestionClicked(e)}},{key:"_load",value:function(){var e=[this._provider.getLibraries(),this._provider.getSearchSuggestions()];return a.Promise.all(e)}},{key:"_renderLibraries",value:function(){var e=this,t=this.state.libraries.map(function(t){return a.ReactBEM.createElement(l.default,{onClick:e._onLibraryClick,library:t})});return a.ReactBEM.createElement("li",{bem:"e:item"},a.ReactBEM.createElement("bem",{specifier:"b:photoRoll"},a.ReactBEM.createElement("div",{bem:"e:headline"},"Browse libraries"),a.ReactBEM.createElement("ul",{bem:"$e:libraryList"},t)))}},{key:"_renderSearchSuggestions",value:function(){var e=this;if(!this.state.searchSuggestions.length)return null;var t=this.state.searchSuggestions.map(function(t){return a.ReactBEM.createElement(c.default,{onClick:e._onSearchSuggestionClick,searchSuggestion:t})});return a.ReactBEM.createElement("li",{bem:"e:item"},a.ReactBEM.createElement("bem",{specifier:"b:photoRoll"},a.ReactBEM.createElement("div",{bem:"e:headline"},"Search suggestions"),a.ReactBEM.createElement("ul",{bem:"$e:libraryList"},t)))}},{key:"_renderContent",value:function(){return a.ReactBEM.createElement("div",{bem:"$b:photoRoll e:row m:fullHeight"},a.ReactBEM.createElement("div",{bem:"e:cell",ref:"cell"},a.ReactBEM.createElement("div",{bem:"e:container",ref:"container"},a.ReactBEM.createElement("div",{bem:"e:innerContainer"},a.ReactBEM.createElement("ul",{bem:"$e:groupList"},this._renderLibraries(),this._renderSearchSuggestions())))))}},{key:"renderWithBEM",value:function(){return this.state.loading?a.ReactBEM.createElement("div",null):this._renderContent()}}]),t}();t.default=u,u.contextTypes=a.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._bindAll("_onClick"),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"_onClick",value:function(){this.props.onClick&&this.props.onClick(this.props.library)}},{key:"renderWithBEM",value:function(){var e=this.props.library,t={backgroundImage:"url("+e.coverImage+")"};return r.ReactBEM.createElement("bem",{specifier:"b:photoRoll e:libraryList"},r.ReactBEM.createElement("li",{bem:"e:item",style:t,onClick:this._onClick},r.ReactBEM.createElement("div",{bem:"e:overlay"}),r.ReactBEM.createElement("div",{bem:"e:name"},e.name)))}}]),t}();t.default=o,o.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"renderWithBEM",value:function(){var e=this.props.photo;return r.ReactBEM.createElement("bem",{specifier:"b:photoRoll e:photoList"},r.ReactBEM.createElement("li",{bem:"$e:item",onClick:this.props.onClick},r.ReactBEM.createElement("div",{bem:"e:overlay"}),r.ReactBEM.createElement("div",{bem:"e:title"},e.title),r.ReactBEM.createElement("img",{bem:"e:image",src:e.urls.thumb})))}}]),t}();t.default=o,o.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(39)),s=i(n(112)),l=i(n(1)),c=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),r(t,[{key:"componentWillReceiveProps",value:function(e){e.query!==this.props.query&&this._loadPhotos(e.query)}},{key:"_getHeadline",value:function(){return this._t("pesdk.library.title.searchResults",{query:this.props.query})}},{key:"_loadPhotos",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props.query;this._totalPhotosHeight=0;var n=l.default.instance.displayProgress(this._t("pesdk.common.text.loading"));(new(0,this.context.options.photoRoll.provider)).searchPhotos(t).then(function(t){return e._preloadPhotos(t,n)}).then(function(t){e.setState({photos:t,loading:!1}),n.close()})}},{key:"_renderNotFound",value:function(){return o.ReactBEM.createElement(s.default,{query:this.props.query,onSearchSuggestionClicked:this.props.onSearchSuggestionClicked})}},{key:"renderWithBEM",value:function(){return this.state.loading?o.ReactBEM.createElement("div",null):0===this.state.photos.length?this._renderNotFound():this._renderPhotos()}}]),t}();t.default=c,c.contextTypes=a.default.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(38)),a=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));o._bindAll("_onSearchSuggestionClick");var a=o.context.options.photoRoll.provider;return o._provider=new a,o.state={searchSuggestions:[]},o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"_onSearchSuggestionClick",value:function(e){this.props.onSearchSuggestionClicked&&this.props.onSearchSuggestionClicked(e)}},{key:"componentDidMount",value:function(){var e=this;(function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this),this._provider.getSearchSuggestions().then(function(t){e.setState({searchSuggestions:t})})}},{key:"_renderMessage",value:function(){return{__html:this._t("pesdk.library.text.noSearchResults",{query:this.props.query})}}},{key:"_renderSearchSuggestions",value:function(){var e=this;if(!this.state.searchSuggestions.length)return null;var t=this.state.searchSuggestions.map(function(t){return r.ReactBEM.createElement(o.default,{onClick:e._onSearchSuggestionClick,searchSuggestion:t})});return r.ReactBEM.createElement("div",null,r.ReactBEM.createElement("div",{bem:"e:headline"},"Search suggestions"),r.ReactBEM.createElement("ul",{bem:"$e:libraryList"},t))}},{key:"renderWithBEM",value:function(){return r.ReactBEM.createElement("div",{bem:"$b:photoRoll e:row m:fullHeight"},r.ReactBEM.createElement("div",{bem:"e:cell"},r.ReactBEM.createElement("div",{bem:"e:container"},r.ReactBEM.createElement("div",{bem:"e:innerContainer"},r.ReactBEM.createElement("div",{bem:"e:noSearchResults",dangerouslySetInnerHTML:this._renderMessage()}),this._renderSearchSuggestions()))))}}]),t}();t.default=a,a.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(10)),s=i(n(14)),l=i(n(114)),c=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e._bindAll("_onCancel","_onWebcamReady","_onShutterClicked"),e.state={webcamReady:!1},e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),r(t,[{key:"_onWebcamReady",value:function(){this.setState({webcamReady:!0})}},{key:"_onCancel",value:function(){this.props.app.switchToScreen("back")}},{key:"_onShutterClicked",value:function(){var e=this;this.refs.webcam.makePhoto().then(function(t){e.props.app.setImage(t)}).catch(function(e){o.Log.error(e)})}},{key:"_renderScreen",value:function(){return o.ReactBEM.createElement("div",{bem:"$b:webcamScreen"},o.ReactBEM.createElement(s.default,{label:this._t("pesdk.camera.title.headline")},o.ReactBEM.createElement("bem",{specifier:"$b:topBar"},o.ReactBEM.createElement("div",{bem:"e:cancelButton",onClick:this._onCancel},this._t("pesdk.common.button.cancel")),o.ReactBEM.createElement("div",{bem:"e:label"},this._t("pesdk.camera.title.headline")))),o.ReactBEM.createElement("div",{bem:"$b:canvas e:container e:row"},o.ReactBEM.createElement("div",{bem:"e:container e:cell"},o.ReactBEM.createElement(l.default,{ref:"webcam",onReady:this._onWebcamReady,onBack:this._onCancel}))),o.ReactBEM.createElement("div",{bem:"$b:controls $e:container e:row"},o.ReactBEM.createElement("div",{bem:"e:cell"},o.ReactBEM.createElement("bem",{specifier:"b:webcamScreen"},o.ReactBEM.createElement("div",{bem:"$e:shutterButton",onClick:this._onShutterClicked,className:!!this.state.webcamReady&&"is-active"},o.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("controls/webcam/shutter.png",!0)}))))))}}]),t}();t.default=c,c.contextTypes=a.default.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(1)),s=i(n(115)),l=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e._bindAll("_onWebcamReady","_onWebcamError"),e.state={webcamReady:!1},e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.BaseComponent),r(t,[{key:"shouldComponentUpdate",value:function(e,t){return!1}},{key:"_onWebcamReady",value:function(){this.props.onReady&&this.props.onReady(),this.setState({webcamReady:!0})}},{key:"_onWebcamError",value:function(e){var t=this;a.default.instance.displayError(this._t("pesdk.common.title.error"),this._t("pesdk.camera.text.webcamUnavailable",{error:e})).on("close",function(){return t.props.onBack()})}},{key:"makePhoto",value:function(){if(this.state.webcamReady)return this._webcam.capture()}},{key:"renderWithBEM",value:function(){var e=this;return o.ReactBEM.createElement("div",{bem:"$b:webcam",ref:"container"},o.ReactBEM.createElement(s.default,{flashURL:this._getAssetPath("fallback/webcam.swf"),ref:function(t){e._webcam=t},onWebcamError:this._onWebcamError,onWebcamAvailable:this._onWebcamReady}))}}]),t}();t.default=l,l.propTypes={onReady:o.PropTypes.func},l.contextTypes=o.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n._bindAll("_onLoadedMetadata"),n.state={webcamAvailable:!1,useFlashFallback:!1,containerWidth:null,containerHeight:null},n._getUserMedia=null,n._webcamStream=null,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"componentDidMount",value:function(){var e=this;if(this._initGetUserMedia(),this._calculateFlashDimensions(),this._getUserMedia)this._getUserMedia({video:{optional:[{minWidth:320},{minWidth:640},{minWidth:1024},{minWidth:1280},{minWidth:1920},{minWidth:2560}]},audio:!1}).then(function(t){e._webcamStream=t;var n=e._videoElement;"srcObject"in n?n.srcObject=t:n.src=window.URL.createObjectURL(t)}).catch(function(t){e.props.onWebcamError&&e.props.onWebcamError(t)});else{var t=!1;window.Webcam||(window.Webcam={},t=!0),window.Webcam.flashNotify=function(n,i){switch(n){case"cameraLive":e.setState({webcamAvailable:!0},function(){e.props.onWebcamAvailable&&e.props.onWebcamAvailable()}),delete window.Webcam.flashNotify,t&&delete window.Webcam;break;case"error":e.props.onWebcamError&&e.props.onWebcamError(i),delete window.Webcam.flashNotify,t&&delete window.Webcam}}}}},{key:"componentWillUnmount",value:function(){this._disposeWebcam()}},{key:"_initGetUserMedia",value:function(){if(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia&&(this._getUserMedia=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices)),!this._getUserMedia){var e=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;e&&(this._getUserMedia=function(t){return new Promise(function(n,i){return e.call(navigator,t,n,i)})})}this._getUserMedia||this.setState({useFlashFallback:!0})}},{key:"_disposeWebcam",value:function(){if(this._webcamStream){var e=this._webcamStream,t=e.getTracks()[0];t?t.stop():e.stop&&e.stop()}else this._flashWebcam&&this._flashWebcam._releaseCamera()}},{key:"capture",value:function(){var e=this;return this.state.webcamAvailable?this._videoElement&&!this._flashWebcam?new Promise(function(t,n){var i=e._videoElement;if(0===i.readyState)n(new Error("Webcam video not available"));else{var r=document.createElement("canvas");r.width=i.videoWidth,r.height=i.videoHeight,r.getContext("2d").drawImage(i,0,0);var o=new window.Image;o.addEventListener("load",function(){t(o)}),o.src=r.toDataURL("image/jpeg")}}):this._flashWebcam?new Promise(function(t,n){var i=e._flashWebcam._snap(),r=new Image;r.onload=function(){t(r)},r.src="data:image/jpeg;base64,"+i}):Promise.reject(new Error("Webcam video not available")):Promise.reject(new Error("Webcam video not available"))}},{key:"_getIEHeight",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100,t=this._container,n=0;n<1e3&&!(t.clientHeight>e)&&t.parentNode;n++)t=t.parentNode;return t.clientHeight>e?t.clientHeight:null}},{key:"_calculateFlashDimensions",value:function(){var e=.9*(this._getIEHeight()||window.innerHeight),t=4/3*e||640,n=e||480;this.setState({containerWidth:t,containerHeight:n})}},{key:"_getFlashFallbackComponent",value:function(){var e=this,t=this.state.containerWidth||640,n=this.state.containerHeight||480,i="width="+t+"&height="+n+"&dest_width=1024&dest_height=768&jpeg_quality=100&fps=24";return r.React.createElement("object",{classID:"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000",type:"application/x-shockwave-flash",width:t,height:n,ref:function(t){e._flashWebcam=t},align:"middle"},r.React.createElement("param",{name:"wmode",value:"transparent"}),r.React.createElement("param",{name:"allowScriptAccess",value:"always"}),r.React.createElement("param",{name:"allowFullScreen",value:"false"}),r.React.createElement("param",{name:"movie",value:this.props.flashURL}),r.React.createElement("param",{name:"loop",value:"false"}),r.React.createElement("param",{name:"menu",value:"false"}),r.React.createElement("param",{name:"quality",value:"best"}),r.React.createElement("param",{name:"bgcolor",value:"#ffffff"}),r.React.createElement("param",{name:"flashvars",value:i}))}},{key:"_onLoadedMetadata",value:function(){var e=this;this.setState({webcamAvailable:!0},function(){e.props.onWebcamAvailable&&e.props.onWebcamAvailable()})}},{key:"render",value:function(){var e=this,t=this.state.useFlashFallback?this._getFlashFallbackComponent():r.React.createElement("video",{style:{width:"100%"},autoPlay:!0,ref:function(t){e._videoElement=t},onLoadedMetadata:this._onLoadedMetadata});return r.React.createElement("div",{style:{width:this.state.useFlashFallback?this.state.containerWidth:"100%",height:this.state.useFlashFallback?this.state.containerHeight:"100%",display:"block",margin:"auto",overflow:"hidden"},ref:function(t){e._container=t}},t)}}]),t}();t.default=o,o.propTypes={flashURL:r.PropTypes.string,onWebcamAvailable:r.PropTypes.func,onWebcamError:r.PropTypes.func}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0},a=n(0),s=i(n(40)),l=i(n(10)),c=i(n(119)),u=i(n(1)),f=i(n(120)),p=i(n(41)),d=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._overviewControls=s.default,o._bindAll("switchToControls","_startEditor","_onWindowResize","_onWindowResizeDone","_onImageResize","_onNewImage","_onRenderError"),o._previousControlsStack=[],o.state={zoom:null,controls:f.default,dragEnabled:!0,sharedState:new a.SharedState},o._editor=new p.default(o.context.ui,o.context.options,o.context.mediator),o._editor.on("new-image",o._onNewImage),o._editor.on("ready",o._startEditor),o._editor.on("resize",o._onImageResize),o._editor.on("render-error",o._onRenderError),o._hasUsedForceCrop=!1,o._forceControls=o.context.options.editor.forceControls,o._forceControlIndex=0,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l.default),r(t,[{key:"componentDidMount",value:function(){var e=this;o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this);var n=this.context.options,i=this.context.options.editor,r=i.image,a=i.forceCrop;this.setImage(r),this._editor.render(),this._editor.on("ready",function(){a?e._switchToFroceCropControl():e._switchToNextForceControl()}),n.responsive&&window.addEventListener("resize",this._onWindowResize)}},{key:"componentWillUnmount",value:function(){o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentWillUnmount",this).call(this),this._editor.dispose(),this.context.options.responsive&&window.removeEventListener("resize",this._onWindowResize)}},{key:"_startEditor",value:function(){this._editor.start()}},{key:"_switchToFroceCropControl",value:function(){var e=this._editor.controls.getAvailable().transform;e&&(this.switchToControls(e,{},null,{forceCrop:!0,firstCrop:!0}),this._hasUsedForceCrop=!0)}},{key:"_switchToNextForceControl",value:function(){if(this._forceControlIndex<this._forceControls.length){var e=this._forceControls[this._forceControlIndex],t=e.control,n=e.options,i=this._editor.controls.getAvailable()[t],r=a.SDKUtils.defaults({forcedControl:!0},n);if(!i)throw new Error("Force controls: Could not find control with identifier `"+t+"`");this.switchToControls(i,{},null,r),this._forceControlIndex++}}},{key:"_onRenderError",value:function(e){u.default.instance.displayError(this._t("pesdk.editor.title.renderingError"),this._t("pesdk.editor.text.renderingError"),!0),a.Log.error(this.constructor.name,"An error occurred while rendering: "+e.message)}},{key:"_onNewImage",value:function(){this.switchToControls(f.default)}},{key:"_onImageResize",value:function(){var e=this,t=u.default.instance.displayLoading(this._t("pesdk.editor.text.resizing"));this._editor.once("resized",function(n){var i=n.dimensions,r=n.reason;t.close(),e.context.options.editor.displayResizeMessage&&u.default.instance.displayWarning(e._t("pesdk.editor.title.imageResized_"+r),e._t("pesdk.editor.text.imageResized_"+r,{maxMegaPixels:e._editor.getMaxMegapixels(),width:i.x,height:i.y}))})}},{key:"_onWindowResize",value:function(){this._resizeTimeout&&(window.clearTimeout(this._resizeTimeout),this._resizeTimeout=null),this._resizeTimeout=window.setTimeout(this._onWindowResizeDone,500)}},{key:"_onWindowResizeDone",value:function(){this._emitEvent(a.Constants.EVENTS.WINDOW_RESIZE)}},{key:"switchToControls",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=null;if("back"===e)r=this._previousControlsStack.pop();else if("home"===e||e===f.default){if(this.context.options.editor.forceCrop&&!this._hasUsedForceCrop)return this._switchToFroceCropControl();if(this._forceControlIndex<this._forceControls.length)return this._switchToNextForceControl();r=f.default,this._previousControlsStack=[]}else r=e,this._previousControlsStack.push(this.state.controls);var o=this.state.controls!==r;this.state.controls.onExit&&this.state.controls.onExit.call(this.refs.controls),this.state.sharedState.clear(),this.state.sharedState.set(t,!1);var s=a.SDKUtils.defaults(a.SDKUtils.defaults(i,this.context.options.editor.controlsOptions[r.identifier]),r.defaultOptions);if(r.onEnter&&r.onEnter.call(this.refs.controls,this.state.sharedState,s),!o)return n&&n();this.setState({controls:r,controlsOptions:s},n)}},{key:"getZoom",value:function(){return this.state.zoom}},{key:"export",value:function(){for(var e=this,t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];return new Promise(function(t,i){e.switchToControls("home",{},function(){var r;(r=e._editor).export.apply(r,n).then(t).catch(i)})})}},{key:"getEditor",value:function(){return this._editor}},{key:"serialize",value:function(){var e;return(e=this._editor).serialize.apply(e,arguments)}},{key:"deserialize",value:function(e){return this._editor.deserialize(e)}},{key:"_showUndoButton",value:function(){return this._editor.history.isAvailable()}},{key:"getChildContext",value:function(){return{editor:this._editor,ui:this.context.ui,options:this.context.options,editorScreen:this,mediator:this.context.mediator,globalState:this.context.globalState}}},{key:"setImage",value:function(e,t){this._forceControlIndex=0,this._editor.setImage(e,t)}},{key:"_renderScreen",value:function(){var e=this.state.controls.controlsComponent,t=this.state.controls.canvasControlsComponent;t||(t=f.default.canvasControlsComponent);var n=this.state.controls.topBarControlsComponent;n||(n=f.default.topBarControlsComponent);var i=void 0,r=void 0,o=void 0;n&&this.context.options.showTopBar&&(o=a.ReactBEM.createElement(n,{sharedState:this.state.sharedState,options:this.state.controlsOptions,app:this.props.app,ref:"topBarControls"})),e&&(i=a.ReactBEM.createElement(e,{onSwitchControls:this.switchToControls,sharedState:this.state.sharedState,options:this.state.controlsOptions,app:this.props.app,key:this.state.controls.identifier+"-controls",ref:"controls"})),t&&(r=a.ReactBEM.createElement(t,{onSwitchControls:this.switchToControls,sharedState:this.state.sharedState,options:this.state.controlsOptions,app:this.props.app,key:this.state.controls.identifier+"-canvasControls",ref:"canvasControls"}));var s="$b:editorScreen";return this.context.options.showHeader||(s+=" m:noHeader"),a.ReactBEM.createElement("div",{bem:s},o,a.ReactBEM.createElement(c.default,{ref:"canvas",largeControls:this.state.controls.largeCanvasControls},r),a.ReactBEM.createElement("div",{bem:"$b:controls $e:container e:row"},a.ReactBEM.createElement("div",{bem:"e:cell"},i)))}}]),t}();t.default=d,d.childContextTypes={ui:a.PropTypes.object.isRequired,editor:a.PropTypes.object.isRequired,mediator:a.PropTypes.object.isRequired,options:a.PropTypes.object.isRequired,editorScreen:a.PropTypes.object.isRequired,globalState:a.PropTypes.object.isRequired},d.contextTypes=l.default.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"renderWithBEM",value:function(){return r.ReactBEM.createElement("bem",{specifier:"$b:controls"},r.ReactBEM.createElement("div",{bem:"e:cell m:largeButton"},r.ReactBEM.createElement("div",{bem:"$e:largeButton",onClick:this.props.onClick},r.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("controls/back.png",!0)}))))}}]),t}();t.default=o,o.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"renderWithBEM",value:function(){return r.ReactBEM.createElement("bem",{specifier:"$b:controls"},r.ReactBEM.createElement("div",{bem:"e:cell m:largeButton"},r.ReactBEM.createElement("div",{bem:"$e:largeButton",onClick:this.props.onClick},r.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("controls/tick.png",!0)}))))}}]),t}();t.default=o,o.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=function(e){function t(){var e,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var r=arguments.length,a=Array(r),s=0;s<r;s++)a[s]=arguments[s];var l=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a)));return l._bindAll("_onDragStart","_onDragMove","_onDragEnd","_onWindowResize","_onFeaturesUpdated","_onZoomChange"),l._events=(i(n={},o.Constants.EVENTS.WINDOW_RESIZE,l._onWindowResize),i(n,o.Constants.EVENTS.FEATURES_UPDATED,l._onFeaturesUpdated),n),l._initialRenderDone=!1,l.state={canvasPosition:new o.Vector2,canvasOffset:new o.Vector2},l}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.BaseComponent),r(t,[{key:"_onWindowResize",value:function(){var e=this.context.editor;e.getSDK().resizeTo(this._getContainerDimensions()),e.zoom.set("auto")}},{key:"_onFeaturesUpdated",value:function(e){-1!==e.indexOf("drag")&&this.forceUpdate()}},{key:"componentDidMount",value:function(){(function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this);var e=this.context.editor,n=e.getRenderer(),i=this.refs,r=i.canvasCell,a=i.canvas,s=r.offsetWidth,l=r.offsetHeight;n.setCanvas(a),n.resizeTo(new o.Vector2(s,l),!0),e.zoom.on("set",this._onZoomChange)}},{key:"componentWillUnmount",value:function(){this.context.editor.zoom.off("set",this._onZoomChange)}},{key:"_onZoomChange",value:function(){this.forceUpdate()}},{key:"_onDragStart",value:function(e){var t=this.context.editor;t.features.isEnabled("drag")&&(e.preventDefault(),this._dragStartPosition=o.Utils.getEventPosition(e.nativeEvent),this._dragInitialOffset=t.getOffset().clone(),document.addEventListener("mousemove",this._onDragMove),document.addEventListener("touchmove",this._onDragMove),document.addEventListener("mouseup",this._onDragEnd),document.addEventListener("touchend",this._onDragEnd))}},{key:"_onDragMove",value:function(e){var t=o.Utils.getEventPosition(e).clone().subtract(this._dragStartPosition),n=this._dragInitialOffset.clone().add(t),i=this.context.editor,r=i.getOffset().clone();i.setOffset(n),i.getOffset().equals(r)||i.render()}},{key:"_onDragEnd",value:function(e){document.removeEventListener("mousemove",this._onDragMove),document.removeEventListener("touchmove",this._onDragMove),document.removeEventListener("mouseup",this._onDragEnd),document.removeEventListener("touchend",this._onDragEnd)}},{key:"_getContainerDimensions",value:function(){var e=this.refs.canvasCell;return new o.Vector2(e.offsetWidth,e.offsetHeight)}},{key:"_getDraggableStyle",value:function(){return{top:this.state.canvasPosition.y+this.state.canvasOffset.y,left:this.state.canvasPosition.x+this.state.canvasOffset.x}}},{key:"renderWithBEM",value:function(){var e=null,t=null;this.props.largeControls?t=this.props.children:e=this.props.children;var n=this.context.editor,i=n.isReady()&&n.zoom.get()>n.zoom.getDefault(),r=n.features.isEnabled("drag")&&i;return o.ReactBEM.createElement("div",{bem:"$b:canvas e:container e:row"},o.ReactBEM.createElement("div",{bem:"e:container e:cell",ref:"canvasCell"},o.ReactBEM.createElement("div",{bem:"e:innerContainer",className:r?"is-draggable":null,onTouchStart:this._onDragStart,onMouseDown:this._onDragStart,style:this._getDraggableStyle()},o.ReactBEM.createElement("canvas",{bem:"e:canvas",ref:"canvas"}),e),t))}}]),t}();t.default=a,a.contextTypes=o.BaseComponent.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=i(n(4)),o=i(n(121)),a=i(n(40)),s=i(n(126)),l=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.default),t}();l.topBarControlsComponent=o.default,l.controlsComponent=a.default,l.canvasControlsComponent=s.default,t.default=l},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(14)),s=i(n(122)),l=i(n(123)),c=i(n(124)),u=i(n(125)),f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),r(t,[{key:"renderContent",value:function(){var e=null;this.context.options.enableUpload&&(e=o.ReactBEM.createElement(s.default,{app:this.props.app}));var t=null;return this.context.options.editor.enableZoom&&(t=o.ReactBEM.createElement(u.default,null)),o.ReactBEM.createElement("bem",{specifier:"$b:topBar"},o.ReactBEM.createElement("div",{bem:"e:left"},e),o.ReactBEM.createElement("div",{bem:"e:right"},o.ReactBEM.createElement(c.default,null),o.ReactBEM.createElement(l.default,null)),t)}}]),t}();t.default=f,f.contextTypes=a.default.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(26)),s=i(n(25)),l=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._bindAll("_onNewFile","_onButtonClick"),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.BaseComponent),r(t,[{key:"_onNewFile",value:function(e){var t=this.context.editor;t.reset(),t.setImage(e),t.zoom.set("auto")}},{key:"_onButtonClick",value:function(){var e=this.context.options,t=!1===e.enableWebcam||o.Utils.isMobile(),n=!!e.photoRoll.provider;t&&!n?this.refs.upload.open():n?this.props.app.switchToScreen("photoRoll"):this.props.app.switchToScreen("splash")}},{key:"renderWithBEM",value:function(){var e=null;return e=this.context.options.photoRoll.provider?this._t("pesdk.editor.button.backgroundImage"):this._t("pesdk.editor.button.new"),o.ReactBEM.createElement("div",null,o.ReactBEM.createElement(s.default,{onNewFile:this._onNewFile,ref:"upload"}),o.ReactBEM.createElement(a.default,{label:e,icon:"editor/new.png",onClick:this._onButtonClick}))}}]),t}();t.default=l,l.contextTypes=o.BaseComponent.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(1)),s=i(n(26)),l=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._bindAll("_onButtonClick"),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.BaseComponent),r(t,[{key:"_onButtonClick",value:function(){var e=this,t=this.context,n=t.options,i=t.editor,r=t.editorScreen,o=n.editor.export;r.switchToControls("home",null,function(){var t=a.default.instance.displayLoading(e._t("pesdk.editor.text.exporting"));setTimeout(function(){i.export(o.download).then(function(){t.close()}).catch(function(n){a.default.instance.displayError(e._t("pesdk.common.title.error"),n.message),t.close()})},100)})}},{key:"renderWithBEM",value:function(){return this.context.options.editor.export.showButton?o.ReactBEM.createElement(s.default,{style:"blue",label:this._t("pesdk.editor.button.export"),icon:"editor/export.png",onClick:this._onButtonClick}):null}}]),t}();t.default=l,l.contextTypes=o.BaseComponent.contextTypes},function(e,t,n){"use strict";function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=function(e){return e&&e.__esModule?e:{default:e}}(n(26)),s=function(e){function t(){var e,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var r=arguments.length,a=Array(r),s=0;s<r;s++)a[s]=arguments[s];var l=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a)));return l._bindAll("_onButtonClick","_onHistoryUpdated","_onFeaturesUpdated"),l._events=(i(n={},o.Constants.EVENTS.HISTORY_UPDATED,l._onHistoryUpdated),i(n,o.Constants.EVENTS.FEATURES_UPDATED,l._onFeaturesUpdated),n),l}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.BaseComponent),r(t,[{key:"_onFeaturesUpdated",value:function(){this.forceUpdate()}},{key:"_onHistoryUpdated",value:function(){this.forceUpdate()}},{key:"_onButtonClick",value:function(){this.context.editor.history.undo()}},{key:"renderWithBEM",value:function(){return this.context.editor.history.isAvailable()?o.ReactBEM.createElement(a.default,{label:this._t("pesdk.editor.button.undo"),icon:"editor/undo.png",onClick:this._onButtonClick}):null}}]),t}();t.default=s,s.contextTypes=o.BaseComponent.contextTypes},function(e,t,n){"use strict";function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=function(e){function t(){var e,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var r=arguments.length,a=Array(r),s=0;s<r;s++)a[s]=arguments[s];var l=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a)));return l._bindAll("_onZoomOutClick","_onZoomInClick","_onZoomDone","_onFeaturesUpdated"),l._events=(i(n={},o.Constants.EVENTS.ZOOM_DONE,l._onZoomDone),i(n,o.Constants.EVENTS.FEATURES_UPDATED,l._onFeaturesUpdated),n),l}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.BaseComponent),r(t,[{key:"_onFeaturesUpdated",value:function(){this.forceUpdate()}},{key:"_onZoomDone",value:function(){this.forceUpdate()}},{key:"_onZoomOutClick",value:function(e){var t=this.context.editor;t.features.isEnabled("zoom")&&t.zoom.out()}},{key:"_onZoomInClick",value:function(e){var t=this.context.editor;t.features.isEnabled("zoom")&&t.zoom.in()}},{key:"renderWithBEM",value:function(){var e=this.context.editor,t=e.zoom.get(),n=e.features.isEnabled("zoom");return o.ReactBEM.createElement("bem",{specifier:"b:editorScreen"},o.ReactBEM.createElement("div",{bem:"$e:zoom"},o.ReactBEM.createElement("div",{bem:"$e:button m:zoomOut",onClick:this._onZoomOutClick,className:n?null:"is-disabled"},o.ReactBEM.createElement("img",{bem:"e:image",src:this._getAssetPath("controls/minus.png",!0)})),o.ReactBEM.createElement("div",{bem:"e:label"},this._t("pesdk.editor.title.zoom"),o.ReactBEM.createElement("br",null),Math.round(100*t),"%"),o.ReactBEM.createElement("div",{bem:"$e:button m:zoomIn",onClick:this._onZoomInClick,className:n?null:"is-disabled"},o.ReactBEM.createElement("img",{bem:"e:image",src:this._getAssetPath("controls/plus.png",!0)}))))}}]),t}();t.default=a,a.contextTypes=o.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(11)),a=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._bindAll("_onClick"),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),i(t,[{key:"_onClick",value:function(e){this._performHitTest(r.Utils.getEventPosition(e))}},{key:"_getContainerStyle",value:function(){if(!this.context.editor.isReady())return{left:0,top:0,width:1,height:1};var e=this.context.editor.getSDK().getSprite().getBounds();return{left:e.x,top:e.y,width:e.width,height:e.height}}},{key:"renderWithBEM",value:function(){return r.ReactBEM.createElement("div",{bem:"$b:canvasControls e:container m:full",ref:"container"},r.ReactBEM.createElement("div",{bem:"$b:canvasControls e:innerContainer",ref:"innerContainer",style:this._getContainerStyle(),onClick:this._onClick,onTouchStart:this._onClick}))}}]),t}();t.default=a,a.contextTypes=o.default.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(128)),a=function(){function e(t,n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._sdk=t,this._options=n,this._download=i}return i(e,[{key:"export",value:function(){var e=this,t=this._getRenderType();return this._sdk.export(t,this._options.format,this._options.quality).then(function(n){return e._download&&e._downloadData(t,n),n})}},{key:"_downloadData",value:function(e,t){switch(e){case r.RenderType.DATAURL:o.default.downloadDataURL(t,this._options.fileBasename);break;case r.RenderType.MSBLOB:o.default.downloadMSBlob(t,this._options.fileBasename)}}},{key:"_getRenderType",value:function(){var e=this._options;return e.type===r.RenderType.IMAGE&&this._download?r.Utils.supportsMSBlob()?r.RenderType.MSBLOB:r.RenderType.DATAURL:e.type}}]),e}();t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return i(e,null,[{key:"downloadDataURL",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"photoeditorsdk-export",n=this.createBlobURLFromDataURL(e),i=this.getExtensionFromDataURL(e),r=document.createElement("a");r.download=t+"."+i,r.href=n,document.body.appendChild(r),r.click(),document.body.removeChild(r)}},{key:"downloadMSBlob",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"photoeditorsdk-export";navigator.msSaveBlob(e,t+".png")}},{key:"getExtensionFromDataURL",value:function(e){return e.split(",")[0].split(":")[1].split(";")[0].split("/").pop()}},{key:"createBlobURLFromDataURL",value:function(e){if(!(window.Blob&&window.URL&&ArrayBuffer&&Uint8Array))return e;for(var t=r.Base64.decode(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],i=new ArrayBuffer(t.length),o=new Uint8Array(i),a=0;a<t.length;a++)o[a]=t[a];var s=new window.Blob([i],{type:n});return window.URL.createObjectURL(s)}}]),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(){function e(t,n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._image=t,this._maxPixels=n,this._maxDimensions=i}return i(e,[{key:"needsResize",value:function(){var e=new r.Vector2(this._image.width,this._image.height),t=e.x*e.y>this._maxPixels,n=null!==this._maxDimensions&&(e.x>this._maxDimensions||e.y>this._maxDimensions);return t||n}},{key:"resize",value:function(){var e=this,t=null,n=null,i=this._maxDimensions;return new r.Promise(function(o,a){window.setTimeout(function(){var a=new r.Vector2(e._image.width,e._image.height).clone();if(a.x*a.y>e._maxPixels&&(a.copy(e._getDimensionsByMaxPixels()),t="maxMegaPixels"),null!==i&&(a.x>i||a.y>i)){var s=Math.min(i/a.x,i/a.y);a.multiply(s),t="maxDimensions"}a.floor(),n=e._createResizedImageCanvas(a),o({canvas:n,dimensions:a,reason:t})},1e3)})}},{key:"_createResizedImageCanvas",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,n=this._image,i=document.createElement("canvas");i.width=e.x,i.height=e.y;var r=e.clone().subtract(t).divide(2);return i.getContext("2d").drawImage(n,0,0,n.width,n.height,r.x,r.y,t.x,t.y),i}},{key:"_getDimensionsByMaxPixels",value:function(){var e=this._image,t=this._maxPixels,n=e.width/e.height,i=e.height/e.width;return new r.Vector2(Math.sqrt(t*n),Math.sqrt(t*i)).floor()}}]),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(e){return e&&e.__esModule?e:{default:e}}(n(5)),o=n(0),a=function(){function e(t,n,i){var o=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._editor=t,this._sdk=n,this._mediator=i,this._map={},this._stack=this._sdk&&this._sdk.getOperationsStack(),this._preferredOrder=this._editor.getOptions().editor.operationsOrder,this._available={};var a=r.default.Operations;for(var s in a){var l=a[s];this._available[l.identifier]=l}t.getOptions().extensions.operations.forEach(function(e){o._available[e.identifier]=e}),this._stack&&this._fixStack()}return i(e,[{key:"exists",value:function(e){return!!this._map[e]}},{key:"add",value:function(e){var t=this,n=e.constructor.identifier;e.on("update",function(){t._mediator.emit(o.Constants.EVENTS.OPERATION_UPDATED,e)});var i=this._preferredOrder.indexOf(n);if(-1===i)throw new Error("EditorOperations#add: `"+n+"` does not appear in `operationsOrder`");this._stack.set(i,e),this._map[n]=e,this._mediator.emit(o.Constants.EVENTS.OPERATION_CREATED,e)}},{key:"remove",value:function(e){var t=e.constructor.identifier,n=this._stack.getStack();delete this._map[t];var i=n.map(function(e){return e.constructor.identifier}).indexOf(e.constructor.identifier);if(-1!==i){this._stack.removeAt(i);for(var r=i+1;r<n.length;r++){var a=n[r];a&&a.setDirty(!0)}this._mediator.emit(o.Constants.EVENTS.OPERATION_REMOVED,e)}}},{key:"get",value:function(e){return this._map[e]}},{key:"getOrCreate",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._map[e]){var n=this._map[e];return n.set(t,!1),n}var i=new(0,this._available[e])(this._sdk,t);return this.add(i),i}},{key:"getStack",value:function(){return this._stack}},{key:"isAvailable",value:function(e){return!!this._available[e]}},{key:"getAvailable",value:function(){return this._available}},{key:"reset",value:function(){this._map={}}},{key:"_fixStack",value:function(){var e=this,t=this._stack.getStack().slice();this._stack.clear(),t.forEach(function(t){e.add(t)})}}]),e}();t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(42)),o=n(0),a=function(){function e(t,n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._editor=t,this._sdk=n,this._mediator=i,this._invalidOperationsSeen=[],this._options=this._editor.getOptions(),r["selective-blur"]=r.selectiveBlur,this._available=o.SDKUtils.extend({},r,this._options.extensions.controls)}return i(e,[{key:"isEnabled",value:function(e){var t=this,n=this.get(e);if(!n)return o.Log.info("EditorControls#isEnabled: Unknown control: "+e),!1;var i=[];return(n.requiredOperations||[]).forEach(function(e){t._editor.operations.isAvailable(e)||i.push(e)}),i.length?(-1===this._invalidOperationsSeen.indexOf(e)&&(this._invalidOperationsSeen.push(e),o.Log.error("Control `"+e+"` can not be used because "+(1===i.length?"operation is":"operations are")+" missing: "+i.map(function(e){return"`"+e+"`"}).join(", "))),!1):n.isAvailable&&n.isAvailable(this._editor)}},{key:"get",value:function(e){return this._available[e]}},{key:"getAvailable",value:function(){return this._available}}]),e}();t.default=a},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=i(n(4)),a=i(n(133)),s=["brightness","clarity","contrast","exposure","highlights","saturation","shadows","gamma","whites","blacks","temperature","sharpness"],l=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),r(t,null,[{key:"onEnter",value:function(e){var t=this.context.editor,n=t.operations.exists("adjustments"),i=t.operations.getOrCreate("adjustments"),r=i.serializeOptions();this.setSharedState({operation:i,operationExistedBefore:n,initialOptions:r})}},{key:"isAvailable",value:function(e){return e.isToolAllowed("adjustment")&&s.filter(function(t){return e.isToolEnabled(t)}).length>0}},{key:"getPreloadAssets",value:function(e){return s.filter(function(t){return e.isToolEnabled(t)}).map(function(e){return"controls/adjustments/"+e+".png"})}}]),t}();l.controlsComponent=a.default,l.identifier="adjustments",l.iconPath="controls/overview/adjustments.png",l.languageKey="pesdk.adjustments.title.name",l.defaultOptions={},l.requiredOperations=["adjustments"],t.default=l},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(3)),s=i(n(2)),l=i(n(7));i(n(134));var c=o.SDK.Operations.AdjustmentsOperation,u=["brightness","saturation","contrast","gamma","clarity","exposure","shadows","highlights","whites","blacks","temperature","sharpness"],f=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));o._bindAll("_onSliderValueChange");var a=o.context.editor;return o._operation=a.operations.getOrCreate("adjustments"),o.state={selectedControls:null},o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),r(t,[{key:"_onBackClick",value:function(e){var n=this.context.editor,i=this.getSharedState("operationExistedBefore"),r=this.getSharedState("initialOptions");this._operation.optionsEqual(r)||n.history.add(this._operation,r,i);var o=this._operation.getDefaultOptions();this._operation.optionsEqual(o)&&n.operations.remove(this._operation),function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_onBackClick",this).call(this,e)}},{key:"_onSliderValueChange",value:function(e){var t=this.state.selectedControls,n=c.prototype.availableOptions[t],i=n.minValue,r=n.midValue,o=n.maxValue;e=e<0?r+(r-i)*e/100:r+(o-r)*e/100,this._operation.setOption(t,e),this.context.editor.render()}},{key:"_onButtonClick",value:function(e,t){this.setState({selectedControls:e})}},{key:"_buildSliderProps",value:function(e){var t=c.prototype.availableOptions[e],n=t.minValue,i=t.midValue,r=t.maxValue,o=this._operation?this._operation.getOption(e):i;return{minValue:-100,maxValue:100,value:100*(o<=i?(o-n)/(i-n)-1:(o-i)/(r-i)),valueUnit:"%",positiveValuePrefix:"+",label:this._t("pesdk.adjustments.text."+e),middleDot:!0,onChange:this._onSliderValueChange}}},{key:"renderOverlayControls",value:function(){var e=this.state.selectedControls;if(e){var t=this._buildSliderProps(e);return o.ReactBEM.createElement(l.default,t)}}},{key:"_renderListItems",value:function(){var e=this;return u.filter(function(t){return e.context.editor.isToolEnabled(t)}).map(function(t){var n=e.state.selectedControls===t,i=n?"is-active":null;return o.ReactBEM.createElement("li",{bem:"e:item",key:t,"data-identifier":t},o.ReactBEM.createElement("bem",{specifier:"$b:controls"},o.ReactBEM.createElement("div",{bem:"$e:button m:withLabel",onClick:e._onButtonClick.bind(e,t),className:i},o.ReactBEM.createElement("img",{bem:"e:icon",src:e._getAssetPath("controls/adjustments/"+t+".png",!0)}),o.ReactBEM.createElement("div",{bem:"e:label"},e._t("pesdk.adjustments.text."+t)),void 0)))})}},{key:"renderControls",value:function(){var e=this._renderListItems();return o.ReactBEM.createElement("div",{bem:"e:cell m:list"},o.ReactBEM.createElement(s.default,null,o.ReactBEM.createElement("ul",{bem:"$e:list"},e)))}}]),t}();t.default=f,f.contextTypes=a.default.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o.state={value:o.props.value||0,sliderPosition:0,foregroundLeft:0,foregroundWidth:0},o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.BaseComponent),r(t,[{key:"componentDidMount",value:function(){this._setValue(this.state.value,!1)}},{key:"componentWillReceiveProps",value:function(e){e.value!==this.state.value&&this._setValue(e.value,!1)}},{key:"_getKnobStyle",value:function(){return{left:this.state.sliderPosition}}},{key:"_getForegroundStyle",value:function(){return{left:this.state.foregroundLeft,width:this.state.foregroundWidth}}},{key:"_displayMiddleDot",value:function(){return!1!==this.props.middleDot}},{key:"_setValue",value:function(e){!(arguments.length>1&&void 0!==arguments[1])||arguments[1],e=Math.round(e);var t=this.props,n=t.minValue,i=(e-n)/(t.maxValue-n),r=this.refs.bar.offsetWidth,o=r*i,a=i*r,s=0;this._displayMiddleDot()&&(a=Math.abs(i-.5)*r,s=i<.5?.5*r-a:"50%"),this.setState({value:e,sliderPosition:o,foregroundWidth:a,foregroundLeft:s})}},{key:"renderWithBEM",value:function(){var e={style:this._getForegroundStyle()};return o.ReactBEM.createElement("div",{bem:"$b:miniSlider"},o.ReactBEM.createElement("div",{bem:"$e:bar",ref:"bar"},o.ReactBEM.createElement("div",{bem:"$e:background"}),o.ReactBEM.createElement("div",i({bem:"$e:foreground"},e)),o.ReactBEM.createElement("div",{bem:"e:knob",style:this._getKnobStyle()})))}}]),t}();t.default=a,a.contextTypes=o.BaseComponent.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(4)),s=i(n(136)),l=i(n(137)),c=i(n(138)),u=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),r(t,null,[{key:"onEnter",value:function(e){var t=this.context.editor,n=t.operations.exists("transform"),i=t.operations.getOrCreate("transform");i.setEnabled(!1,!1);var r=t.operations.exists("orientation"),a=t.operations.getOrCreate("orientation"),s={end:new o.Vector2(1,1),rotation:0,start:new o.Vector2(0,0),textureScale:1},l=i.getInputDimensions(!1),c=i.getNewDimensions(l),u=s;if(n){delete(u=i.serializeOptions()).enabled;var f=u,p=f.start,d=f.end,h=f.rotation,_=i.calculateScale(h),m=i.getInputDimensions(!1),y=Math.cos(h),g=Math.sin(h),v=d.clone().subtract(p).divide(2),b=p.clone().add(v).multiply(m).subtract(m.clone().multiply(.5)),k=new o.Vector2(b.x*y-b.y*g,b.x*g+b.y*y).multiply(_),w=m.clone().multiply(.5).add(k).clone().divide(m),O=w.clone().subtract(v.clone().multiply(_)),E=w.clone().add(v.clone().multiply(_));u.start=O,u.end=E}t.broadcastTransform(i,s);var S=a.serializeOptions(),P=[10,20,68,20];t.setSpriteScale(i.calculateScale()),t.setRotation(u.rotation),t.setPadding(P),i.set(s,n),t.zoom.set("auto",function(){t.features.disable("zoom","drag")},!1),this.setSharedState({initialTransformOptions:u,initialOrientationOptions:S,operation:i,orientationOperation:a,activePadding:P,orientationOperationExistedBefore:r,transformOperationExistedBefore:n,start:o.Vector2.fromObject(u.start),end:o.Vector2.fromObject(u.end),rotation:u.rotation,orientationRotation:a.getRotation(),flipVertically:a.getFlipVertically(),flipHorizontally:a.getFlipHorizontally(),initialDimensions:c,inputDimensions:l})}},{key:"isAvailable",value:function(e){return e.isToolAllowed("transform")&&e.isToolEnabled("transform")}},{key:"getPreloadAssets",value:function(e){var t=e.getOptions(),n=o.SDKUtils.defaults(t.editor.controlsOptions.transform,this.defaultOptions),i=["controls/transform/rotate-ccw.png","controls/transform/rotate-cw.png","controls/transform/flip-h.png","controls/transform/flip-v.png"];return s.default.getRatios(n).forEach(function(e){Array.isArray(e)?e.forEach(function(e){var t=e.identifier;i.push("controls/transform/"+t+".png")}):i.push("controls/transform/"+e.identifier+".png")}),i}}]),t}();u.topBarControlsComponent=c.default,u.controlsComponent=s.default,u.canvasControlsComponent=l.default,u.identifier="transform",u.iconPath="controls/overview/transform.png",u.languageKey="pesdk.transform.title.name",u.defaultOptions={},u.requiredOperations=["transform"],t.default=u},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(3)),s=i(n(2)),l=i(n(7)),c=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return a._bindAll("_selectRatio","_onRotationChange","_reapplyRatio"),a.state={ratio:null,rotation:0},a._ratios=a.constructor.getRatios(a.props.options),a._events=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},o.Constants.EVENTS.TRANSFORM_REAPPLY_RATIO,a._reapplyRatio),a._selectInitialRatio(!a.getSharedState("transformOperationExistedBefore")),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),r(t,[{key:"shouldSharedComponentUpdate",value:function(e,t){return e.ratio!==t.ratio}},{key:"_onRotationChange",value:function(e){var t=this.getSharedState("operation"),n=this.context.editor;e=e*Math.PI/180,n.setRotation(e),n.setSpriteScale(t.calculateScale(e)),n.render(),this.setSharedState({rotation:e})}},{key:"_getRotatedSpriteDimensions",value:function(){var e=this.context.editor,t=e.getRotation(),n=e.getOutputDimensions(!1);return new o.Vector2(Math.abs(n.x*Math.cos(t))+Math.abs(n.y*Math.sin(t)),Math.abs(n.x*Math.sin(t))+Math.abs(n.y*Math.cos(t)))}},{key:"_calculateTextureScale",value:function(){var e=this.getSharedState("operation"),t=this.getSharedState("ratio");if(!t||!t.dimensions)return 1;var n=this.getSharedState("start"),i=this.getSharedState("end").clone().subtract(n),r=e.getInputDimensions(!1).multiply(i);return t.dimensions.x/r.x}},{key:"_getHistoryItems",value:function(){var e=[],t=this._getTransformHistoryItem();t&&e.push(t);var n=this._getOrientationHistoryItem();return n&&e.push(n),e}},{key:"_getTransformHistoryItem",value:function(){var e=this.context.editor,t=this.getSharedState("operation"),n=this.getSharedState("initialTransformOptions"),i=this.getSharedState("transformOperationExistedBefore");if(!t.optionsEqual(n))return{operation:t,options:n,existent:i,undo:function(t,n){e.broadcastTransform(t,n)}}}},{key:"_getOrientationHistoryItem",value:function(){var e=this.context.editor,t=this.getSharedState("orientationOperation"),n=this.getSharedState("initialOrientationOptions"),i=this.getSharedState("orientationOperationExistedBefore");if(!t.optionsEqual(n))return{operation:t,options:n,existent:i,undo:function(t,n){t.getRotation()!==n.rotation&&e.broadcastRotate(n.rotation-t.getRotation());var i=n.rotation,r=90===i||270===i;t.getFlipVertically()!==n.flipVertically?e.broadcastFlip(r?"horizontal":"vertical"):t.getFlipHorizontally()!==n.flipHorizontally&&e.broadcastFlip(r?"vertical":"horizontal")}}}},{key:"_reapplyRatio",value:function(){var e=this.getSharedState("ratio");this._selectRatio(e)}},{key:"_onBackClick",value:function(e){var n=this.context.editor,i=this.getSharedState("ratio"),r=this.getSharedState("operation"),a=this.getSharedState("orientationOperation"),s=n.getRotation(),l=this.getSharedState("start").clone(),c=this.getSharedState("end").clone();if((null===i||l.equals(0,0)&&c.equals(1,1))&&0===s)n.operations.remove(r);else{var u={rotation:s,start:l,end:c,textureScale:this._calculateTextureScale(),enabled:!0},f=r.calculateScale(s),p=r.getInputDimensions(!1),d=Math.cos(-s),h=Math.sin(-s),_=c.clone().subtract(l).divide(2),m=l.clone().add(_).multiply(p).subtract(p.clone().multiply(.5)),y=new o.Vector2(m.x*d-m.y*h,m.x*h+m.y*d).divide(f),g=p.clone().multiply(.5).add(y).clone().divide(p);u.start=g.clone().subtract(_.clone().divide(f)),u.end=g.clone().add(_.clone().divide(f)),n.broadcastTransform(r,u),r.set(u)}0!==a.getRotation()||a.getFlipVertically()||a.getFlipHorizontally()||n.operations.remove(a),n.setPadding(!1),n.setRotation(0),n.setSpriteScale(1);var v=this._getHistoryItems();if(v.length){var b=this.props.options,k=b.forceCrop,w=b.firstCrop;k||w||n.history.add(v)}n.features.enable("zoom","drag"),n.zoom.set("auto"),function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_onBackClick",this).call(this,e)}},{key:"_selectInitialRatio",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.getSharedState("operation"),n=null,i=o.SDKUtils.Array.flatten(this._ratios),r=t._ratio;return r&&(n=i.filter(function(e){return e===r})[0]),n||(n=i.filter(function(e){return e.selected}).pop()),n||(n=i[0]),this._selectRatio(n,e,!1)}},{key:"_selectRatio",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=this.getSharedState("operation");t&&e&&this._setDefaultOptionsForRatio(e,n),i._ratio=e;var r={ratio:e},a=this.context.editor;e?a.setPadding(this.getSharedState("activePadding")):(a.setPadding(!1),a.setRotation(0),a.setSpriteScale(1),r.rotation=0,r.start=new o.Vector2(0,0),r.end=new o.Vector2(1,1)),a.render(),this.setSharedState(r,n)}},{key:"_setDefaultOptionsForRatio",value:function(e){var t=e.ratio,n=(e.name,e.dimensions),i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.context.editor,a=new o.Vector2,s=new o.Vector2;if(n&&!t&&(t=n.x/n.y),"*"===t)a=new o.Vector2(0,0),s=new o.Vector2(1,1);else{var l=r.getOutputDimensions();if(l.x/l.y<=t){var c=1/l.y*(l.x/t);a.set(0,(1-c)/2),s.set(1,1-a.y)}else{var u=1/l.x*(t*l.y);a.set((1-u)/2,0),s.set(1-a.x,1)}}this.setSharedState({start:a,end:s},i)}},{key:"renderOverlayControls",value:function(){var e=180*this.getSharedState("rotation")/Math.PI;return this.getSharedState("ratio")?o.ReactBEM.createElement(l.default,{value:e,minValue:-45,middleDot:!0,maxValue:45,valueUnit:"°",label:this._t("pesdk.transform.text.rotation"),onChange:this._onRotationChange}):null}},{key:"_renderListItems",value:function(){var e=this,t=[],n=function(t){return o.ReactBEM.createElement("li",{bem:"e:item",key:t.identifier,"data-identifier":t.identifier},o.ReactBEM.createElement("bem",{specifier:"$b:controls"},o.ReactBEM.createElement("div",{bem:"$e:button m:withLabel",className:e.getSharedState("ratio")===t?"is-active":null,onClick:e._selectRatio.bind(e,t)},o.ReactBEM.createElement("img",{bem:"e:icon",src:e._getAssetPath("controls/transform/"+t.identifier+".png",!0)}),o.ReactBEM.createElement("div",{bem:"e:label"},e._t("pesdk.transform.asset."+t.identifier)||t.defaultName))))};this._ratios.forEach(function(e){if(Array.isArray(e)){var i=[];e.forEach(function(e){i.push(n(e))}),i.length&&t.push(i)}else{var r=e;t.push(n(r))}});var i=[];t.forEach(function(e){i=i.concat(e),Array.isArray(e)&&e!==t[t.length-1]&&i.push(o.ReactBEM.createElement("li",{bem:"e:separator"}))});var r=o.ReactBEM.createElement("li",{bem:"e:item","data-identifier":"none",key:"noTransform"},o.ReactBEM.createElement("bem",{specifier:"$b:controls"},o.ReactBEM.createElement("div",{bem:"$e:button m:withLabel",className:this.getSharedState("ratio")?null:"is-active",onClick:this._selectRatio.bind(this,null)},o.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("controls/transform/no-transform.png",!0)}),o.ReactBEM.createElement("div",{bem:"e:label"},this._t("pesdk.transform.button.none")))));return this.context.options.editor.forceCrop?i:[r,o.ReactBEM.createElement("li",{bem:"e:separator"})].concat(i)}},{key:"renderControls",value:function(){var e=this._renderListItems();return o.ReactBEM.createElement("div",{bem:"e:cell m:list"},o.ReactBEM.createElement(s.default,null,o.ReactBEM.createElement("ul",{bem:"$e:list"},e)))}}],[{key:"getRatios",value:function(e){var t=e.ratios,n=e.replaceRatios,i=e.availableRatios;t=t||[];var r=void 0;return r=o.Constants.DEFAULTS.TRANSFORM_RATIOS,r=n?t:r.concat(t),i&&i.length&&(r=r.map(function e(t){return Array.isArray(t)?t.map(e).filter(function(e){return e}):-1===i.indexOf(t.identifier)?null:t}).filter(function(e){return e})),r}}]),t}();t.default=c,c.contextTypes=a.default.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(6)),s=i(n(11)),l=new o.Vector2(50,50),c=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._needsStyleFixes=!0,o._bindAll("_onCenterDragStart","_onCenterDrag"),o.state={dimensions:o.getSharedState("initialDimensions")},o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.default),r(t,[{key:"fixStyles",value:function(){if(o.Utils.Browser.isIElte(11)){var e=this.context.editor,t=this.refs.container,n=e.getCanvasDimensions(!1).y;t.style.height=n+"px"}}},{key:"sharedStateDidChange",value:function(e){e!==this.getSharedState("ratio")&&this._updateDimensions()}},{key:"_updateDimensions",value:function(){var e=this.getSharedState("operation"),t=this.getSharedState("ratio")||{ratio:"*"},n=void 0;if(t.dimensions)n=function(e){return e instanceof o.Vector2?e:new o.Vector2(e.x,e.y)}(t.dimensions);else{var i=e.getInputDimensions(!1),r=this.getSharedState("start");n=this.getSharedState("end").clone().subtract(r).multiply(i).floor()}this.setState({dimensions:n})}},{key:"_onCenterDragStart",value:function(){var e=this.getSharedState("start"),t=this.getSharedState("end");this._initialValues={start:e.clone(),end:t.clone(),size:t.clone().subtract(e)}}},{key:"_onCenterDrag",value:function(e){var t=this.context.editor,n=this._initialValues,i=n.start,r=n.size,a=t.getOutputDimensions(),s=e.clone().divide(a),l=new o.Vector2(0,0),c=new o.Vector2(1,1).subtract(r),u=i.clone().add(s).clamp(l,c),f=u.clone().add(r);this.setSharedState({start:u,end:f})}},{key:"_onKnobDragStart",value:function(e){this._currentDragOption=e,this._initialValues={start:this.getSharedState("start").clone(),end:this.getSharedState("end").clone()}}},{key:"_onKnobDrag",value:function(e,t){var n=this.context.editor.getOutputDimensions(),i=this.getSharedState("ratio")||{ratio:"*"},r=i.ratio,a=i.dimensions;a&&!r&&(r=a.x/a.y);var s=this._initialValues.end.clone().subtract(this._initialValues.start).multiply(n),c=void 0;"start"===e?(s.subtract(t),c=this._initialValues.end.clone().multiply(n)):"end"===e&&(s.add(t),c=new o.Vector2(1,1).subtract(this._initialValues.start).multiply(n));var u=n;if(void 0!==r&&"*"!==r&&(u=r>n.x/n.y?new o.Vector2(n.x,n.x/r):new o.Vector2(n.y*r,n.y)),s.x=Math.min(Math.max(Math.min(l.x,u.x),s.x),c.x),"*"!==r&&(s.y=s.x/r),s.y=Math.min(Math.max(Math.min(l.y,u.y),s.y),c.y),"*"!==r&&(s.x=s.y*r),"start"===e){var f=this._initialValues.end.clone().subtract(s.clone().divide(n));this.setSharedState({start:f},!1),this._updateDimensions()}else if("end"===e){var p=this._initialValues.start.clone().add(s.clone().divide(n));this.setSharedState({end:p},!1),this._updateDimensions()}}},{key:"_calculateDimensions",value:function(){var e=this.context.editor,t=this.getSharedState("start");return this.getSharedState("end").clone().subtract(t).multiply(e.getInputDimensions(!1)).round()}},{key:"_getAreaStyles",value:function(){var e=this.context.editor,t=e.getOutputDimensions(),n=e.getCanvasDimensions(),i=this.getSharedState("start").clone().multiply(t).floor(),r=this.getSharedState("end").clone().multiply(t).ceil().clone().subtract(i),o=n.clone().subtract(t).divide(2).floor(),a=e.getPadding();return i.add(o).add(a[1],a[0]),{topLeft:this._getDimensionsStyles(i.x,i.y),topCenter:this._getDimensionsStyles(r.x,i.y),centerLeft:this._getDimensionsStyles(i.x,r.y),center:this._getDimensionsStyles(r.x,r.y)}}},{key:"_getDimensionsStyles",value:function(e,t){return{width:Math.max(1,e),height:Math.max(1,t)}}},{key:"renderWithBEM",value:function(){var e=this.getSharedState("ratio"),t=this.state.dimensions,n=void 0;if(e){var i=this._getAreaStyles();n=o.ReactBEM.createElement("div",{bem:"$b:transformCanvasControls"},o.ReactBEM.createElement("div",{bem:"e:row"},o.ReactBEM.createElement("div",{bem:"e:cell m:dark",style:i.topLeft}," "),o.ReactBEM.createElement("div",{bem:"e:cell m:dark",style:i.topCenter}," "),o.ReactBEM.createElement("div",{bem:"e:cell m:dark"})),o.ReactBEM.createElement("div",{bem:"e:row"},o.ReactBEM.createElement("div",{bem:"e:cell m:dark",style:i.centerLeft}," "),o.ReactBEM.createElement(a.default,{onStart:this._onCenterDragStart,onDrag:this._onCenterDrag},o.ReactBEM.createElement("div",{bem:"e:cell m:bordered",style:i.center},o.ReactBEM.createElement(a.default,{onStart:this._onKnobDragStart.bind(this,"start"),onDrag:this._onKnobDrag.bind(this,"start")},o.ReactBEM.createElement("div",{bem:"e:knob m:topLeft $b:knob"},o.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("controls/knobs/resize-diagonal-down.png",!0)}))),o.ReactBEM.createElement("div",{bem:"e:dimensions"},t.x+"x"+t.y),o.ReactBEM.createElement(a.default,{onStart:this._onKnobDragStart.bind(this,"end"),onDrag:this._onKnobDrag.bind(this,"end")},o.ReactBEM.createElement("div",{bem:"e:knob m:bottomRight $b:knob"},o.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("controls/knobs/resize-diagonal-down.png",!0)}))))),o.ReactBEM.createElement("div",{bem:"e:cell m:dark"}," ")),o.ReactBEM.createElement("div",{bem:"e:row"},o.ReactBEM.createElement("div",{bem:"e:cell m:dark"}," "),o.ReactBEM.createElement("div",{bem:"e:cell m:dark"}," "),o.ReactBEM.createElement("div",{bem:"e:cell m:dark"}," ")))}else n=o.ReactBEM.createElement("div",{bem:"$b:transformCanvasControls"},o.ReactBEM.createElement("div",{bem:"e:dimensions"},t.x+"x"+t.y));return o.ReactBEM.createElement("div",{bem:"b:canvasControls e:container m:full",ref:"container"},n)}}]),t}();t.default=c,c.contextTypes=s.default.contextTypes},function(e,t,n){"use strict";function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=function(e){return e&&e.__esModule?e:{default:e}}(n(14)),s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),r(t,[{key:"_onRotateClick",value:function(e){var t=this.getSharedState("orientationOperation"),n=t.getFlipVertically()!==t.getFlipHorizontally(),i=void 0;"cw"===e?i=90:"ccw"===e&&(i=-90),i*=n?-1:1;var r=this.context.editor,a=(t.getRotation()+i)%360;t.set({rotation:a});var s={orientationRotation:a},l=this.getSharedState("ratio");if(l&&!l.dimensions){var c=this.getSharedState("start"),u=this.getSharedState("end"),f=c.clone();"cw"===e?(c.set(1-u.y,f.x),u.set(1-f.y,u.x)):"ccw"===e&&(c.set(f.y,1-u.x),u.set(u.y,1-f.x)),s.start=c,s.end=u}l&&l.dimensions&&this._emitEvent(o.Constants.EVENTS.TRANSFORM_REAPPLY_RATIO),this.setSharedState(s),r.broadcastRotate(i),r.zoom.set("auto")}},{key:"_onFlipClick",value:function(e){var t,n=this.context.editor,r=this.getSharedState("orientationOperation"),o=r.getRotation();90!==o&&270!==o||(e="horizontal"===e?"vertical":"horizontal");var a=!this.getSharedState("flip"+e),s=-1*this.getSharedState("rotation");this.setSharedState((i(t={},"flip"+e,a),i(t,"rotation",s),t)),n.setRotation(s),r.flip(e);var l=this.getSharedState("start"),c=this.getSharedState("end"),u=l.clone();"horizontal"===e?(l.set(1-c.x,l.y),c.set(1-u.x,c.y)):"vertical"===e&&(l.set(l.x,1-c.y),c.set(c.x,1-u.y)),this.setSharedState({start:l,end:c}),n.broadcastFlip(e),n.render()}},{key:"shouldSharedComponentUpdate",value:function(e,t){return!1}},{key:"renderContent",value:function(){return o.ReactBEM.createElement("bem",{specifier:"$b:topBar"},o.ReactBEM.createElement("div",{bem:"$e:iconButton",onClick:this._onFlipClick.bind(this,"vertical")},o.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("controls/transform/flip-v.png",!0)})),o.ReactBEM.createElement("div",{bem:"$e:iconButton",onClick:this._onFlipClick.bind(this,"horizontal")},o.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("controls/transform/flip-h.png",!0)})),o.ReactBEM.createElement("div",{bem:"e:space"}),o.ReactBEM.createElement("div",{bem:"$e:iconButton",onClick:this._onRotateClick.bind(this,"ccw")},o.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("controls/transform/rotate-ccw.png",!0)})),o.ReactBEM.createElement("div",{bem:"$e:iconButton",onClick:this._onRotateClick.bind(this,"cw")},o.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("controls/transform/rotate-cw.png",!0)})))}}]),t}();t.default=s,s.contextTypes=a.default.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(4)),s=i(n(140)),l=i(n(27)),c=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),r(t,null,[{key:"onEnter",value:function(e){var t=this.context.editor,n=t.operations.exists("filter"),i=t.operations.getOrCreate("filter"),r=i.serializeOptions(["identifier","filter","intensity"]);this.setSharedState({operation:i,operationExistedBefore:n,initialOptions:r})}},{key:"onExit",value:function(){var e=this.getSharedState("initialOptions"),t=this._operation.getFilter().constructor,n=e.filter.constructor,i=void 0;"3d-lut"===n.identifier&&(i=e.filter.getImage());var r=this._operation.getIntensity();if(this._operation.getIdentifier()!==e.identifier||r!==e.intensity){var o=this.context.editor;o.history.add(this._operation,{identifier:e.identifier,intensity:r},this.getSharedState("operationExistedBefore"),function(){var e=o.operations.getOrCreate("filter");"3d-lut"===n.identifier?e.setFilter(new n({image:i})):e.setFilter(new n)})}t.isIdentity&&this.context.editor.operations.remove(this._operation)}},{key:"isAvailable",value:function(e){return e.isToolAllowed("filter")&&e.isToolEnabled(this.identifier)}},{key:"getPreloadAssets",value:function(e){var t=e.getOptions(),n=o.SDKUtils.defaults(t.editor.controlsOptions.filter,this.defaultOptions),i=new l.default(e.getUI(),n),r=[];return i.getCategories().forEach(function(e){r.push("controls/filters/categories/"+e.identifier+".png"),i.getFiltersForCategory(e.identifier).forEach(function(e){r.push("controls/filters/"+e.identifier+".jpg"),e.lutImage&&r.push([e.lutImage,!1,!1])})}),r}}]),t}();c.controlsComponent=s.default,c.identifier="filter",c.iconPath="controls/overview/filters.png",c.languageKey="pesdk.filter.title.name",c.defaultOptions={categories:[],replaceCategories:!1,availableFilters:null,hideCategories:!1},c.requiredOperations=["filter"],t.default=c},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(3)),s=i(n(2)),l=i(n(43)),c=i(n(7)),u=i(n(27)),f=o.SDK.Operations.FilterOperation.Filters,p=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));a._bindAll("_onItemClick","_onOperationUpdated","_onSliderValueChange","_onCategoryChange"),a._operation=a.getSharedState("operation"),a._events=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},o.Constants.EVENTS.OPERATION_UPDATED,a._onOperationUpdated),a._initFilterManager();var s=a._filterManager.getCategories()[0].identifier;return a.state={category:a._filterManager.getCategoryByIdentifier(s)},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),r(t,[{key:"_initFilterManager",value:function(){this._filterManager=new u.default(this.context.ui,this.props.options)}},{key:"_onSliderValueChange",value:function(e){this._operation.setIntensity(e/100),this.context.editor.render()}},{key:"_onCategoryChange",value:function(e){var t=this;this.setState({category:e},function(){t.refs.scrollbar.update()})}},{key:"_onOperationUpdated",value:function(e){e===this._operation&&this.forceUpdate()}},{key:"_onItemClick",value:function(e,t){var n=this;this._filterManager.instantiateFilterWithIdentifier(e).then(function(t){n._operation.set({filter:t,identifier:e}),n._operation.resetToDefaultFilterIntensity(),n.context.editor.render(),n.forceUpdate()})}},{key:"renderOverlayControls",value:function(){if(this._operation.getFilter().isIdentity)return null;var e=this._operation.getIntensity();return o.ReactBEM.createElement(c.default,{minValue:0,maxValue:100,value:100*e,valueUnit:"%",positiveValuePrefix:"+",label:this._t("pesdk.filter.text.intensity"),onChange:this._onSliderValueChange})}},{key:"_renderListItems",value:function(){var e=this,t=this._operation.getIdentifier(),n=this._filterManager.getFiltersForCategory(this.state.category.identifier);return[f.IdentityFilter].concat(n).map(function(n){var i=n.identifier;return o.ReactBEM.createElement("li",{bem:"e:item",key:i,onClick:e._onItemClick.bind(e,i)},o.ReactBEM.createElement("bem",{specifier:"$b:controls"},o.ReactBEM.createElement("div",{bem:"$e:button m:withInlineLabel"},o.ReactBEM.createElement("img",{bem:"e:icon",src:e._getAssetPath("controls/filters/"+i+".jpg",!0)}),o.ReactBEM.createElement("div",{bem:"$e:inlineLabel",className:i===t?"is-active":null},o.ReactBEM.createElement("div",{bem:"e:label"},e._t("pesdk.filter.asset."+n.identifier)||n.defaultName)))))})}},{key:"_renderCategoryDropdown",value:function(){var e=this,t=this._filterManager.getCategories();if(this.props.options.hideCategories||!(t.length>1))return null;var n=t.map(function(t){return{identifier:t.identifier,item:t,label:e._t("pesdk.filter.asset."+t.identifier)||t.defaultName,icon:e._getAssetPath("controls/filters/categories/"+t.identifier+".png",!0)}}),i={identifier:this.state.category.identifier,item:this.state.category,label:this._t("pesdk.filter.asset."+this.state.category.identifier)||this.state.category.defaultName,icon:this._getAssetPath("controls/filters/categories/"+this.state.category.identifier+".png",!0)};return o.ReactBEM.createElement("div",{bem:"e:cell m:categoryDropdown"},o.ReactBEM.createElement(l.default,{items:n,selectedItem:i,onChange:this._onCategoryChange}))}},{key:"renderControls",value:function(){var e=this._renderListItems();return[this._renderCategoryDropdown(),o.ReactBEM.createElement("div",{bem:"e:cell m:list"},o.ReactBEM.createElement(s.default,{ref:"scrollbar"},o.ReactBEM.createElement("ul",{bem:"$e:list"},e)))]}}]),t}();t.default=p,p.contextTypes=a.default.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"_onItemClick",value:function(e){this.props.onChange&&this.props.onChange(e.item)}},{key:"_renderListItems",value:function(){var e=this;return this.props.items.map(function(t){var n=t.identifier===e.props.selectedItem.identifier;return r.ReactBEM.createElement("li",{bem:"$e:item",className:n?" is-active":"",onClick:e._onItemClick.bind(e,t)},r.ReactBEM.createElement("img",{bem:"e:icon",src:t.icon}),r.ReactBEM.createElement("div",{bem:"e:label"},t.label))})}},{key:"renderWithBEM",value:function(){return r.ReactBEM.createElement("div",{bem:"$b:categoryDropdown $e:overlay"},r.ReactBEM.createElement("ul",{bem:"$e:list"},this._renderListItems()))}}]),t}();t.default=o,o.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=i(n(4)),a=i(n(143)),s=i(n(144)),l=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),r(t,null,[{key:"isAvailable",value:function(e){return e.isToolAllowed("focus")&&(e.isToolEnabled("radial-focus")||e.isToolEnabled("mirrored-focus"))}},{key:"onExit",value:function(){var e=this.context.editor;e.features.enable("zoom","drag");var t=this.getSharedState("initialOptions"),n=this.getSharedState("initialOperation"),i=this.getSharedState("operation");(!i&&n||i&&n&&i.constructor===n.constructor)&&e.history.add(n,t,!0),i&&!n&&e.history.add(i,{},!1),i&&n&&i.constructor!==n.constructor&&e.history.add([{operation:n,options:t,existent:!0},{operation:i,options:{},existent:!1}])}},{key:"onEnter",value:function(e){var t=this.context.editor,n=t.operations.get("mirrored-focus")||t.operations.get("radial-focus"),i={};n&&delete(i=n.serializeOptions()).enabled,this.setSharedState({operation:n,initialOperation:n,operationExistedBefore:!!n,initialOptions:i,inputDimensions:t.getOutputDimensions()})}},{key:"getPreloadAssets",value:function(e){var t=[];return e.isToolEnabled("radial-focus")&&t.push("controls/focus/radial.png"),e.isToolEnabled("mirrored-focus")&&t.push("controls/focus/mirrored.png"),t}}]),t}();l.controlsComponent=a.default,l.canvasControlsComponent=s.default,l.identifier="focus",l.iconPath="controls/overview/focus.png",l.languageKey="pesdk.focus.title.name",l.defaultOptions={},l.requiredOperations=["radial-focus","mirrored-focus","linear-focus","blur"],t.default=l},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(3)),s=i(n(2)),l=i(n(7)),c=[{toolName:"radial-focus",iconName:"radial",languageKey:"pesdk.focus.button.radial"},{toolName:"mirrored-focus",iconName:"mirrored",languageKey:"pesdk.focus.button.mirrored"}],u=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return a._bindAll("_onBlurRadiusChange","_onOperationRemoved"),a._removedOperation=null,a._events=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},o.Constants.EVENTS.OPERATION_REMOVED,a._onOperationRemoved),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),r(t,[{key:"_onBlurRadiusChange",value:function(e){var t=this.getSharedState("operation"),n=this.getSharedState("inputDimensions");t.setBlurRadius(e/n.min()),this.context.editor.render()}},{key:"_onButtonClick",value:function(e,t){var n=this.context.editor,i=this.getSharedState("operation");i&&(this._removedOperation=i,n.operations.remove(i));var r=null;e&&(r=n.operations.getOrCreate(e)),this.setSharedState({operation:r}),n.render()}},{key:"_onOperationRemoved",value:function(e){var t=this.getSharedState("operation");if(t&&e===t&&e!==this._removedOperation&&!this._backButtonClicked){var n=this.context.editor,i=t.constructor.identifier,r=n.operations.getOrCreate(i);this.setSharedState({operation:r,operationExistedBefore:!1,initialOptions:{}})}}},{key:"renderOverlayControls",value:function(){var e=this.getSharedState("operation");if(!e)return null;var t=this.getSharedState("inputDimensions").min(),n=e.getBlurRadius()*t;return o.ReactBEM.createElement(l.default,{minValue:0,maxValue:Math.min(180,Math.round(.1*t)),valueUnit:"px",middleDot:!1,label:this._t("pesdk.focus.text.blurRadius"),onChange:this._onBlurRadiusChange,value:n})}},{key:"_renderListItems",value:function(){var e=this,t=this.getSharedState("operation"),n=this.context.editor;return[o.ReactBEM.createElement("li",{bem:"e:item",key:"none"},o.ReactBEM.createElement("bem",{specifier:"$b:controls"},o.ReactBEM.createElement("div",{bem:"$e:button m:withLabel",className:t?null:"is-active",onClick:this._onButtonClick.bind(this,null)},o.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("controls/focus/none.png",!0)}),o.ReactBEM.createElement("div",{bem:"e:label"},this._t("pesdk.focus.button.none")))))].concat(c.filter(function(e){var t=e.toolName;return n.isToolEnabled(t)}).map(function(n){var i=n.toolName,r=n.iconName,a=n.languageKey,s=t&&t.constructor.identifier===i;return o.ReactBEM.createElement("li",{bem:"e:item","data-identifier":i,key:i},o.ReactBEM.createElement("bem",{specifier:"$b:controls"},o.ReactBEM.createElement("div",{bem:"$e:button m:withLabel",className:s?"is-active":null,onClick:e._onButtonClick.bind(e,i)},o.ReactBEM.createElement("img",{bem:"e:icon",src:e._getAssetPath("controls/focus/"+r+".png",!0)}),o.ReactBEM.createElement("div",{bem:"e:label"},e._t(a)))))}))}},{key:"renderControls",value:function(){var e=this._renderListItems();return o.ReactBEM.createElement("div",{bem:"e:cell m:list"},o.ReactBEM.createElement(s.default,null,o.ReactBEM.createElement("ul",{bem:"$e:list"},e)))}}]),t}();t.default=u,u.contextTypes=a.default.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(11)),s=i(n(145)),l=i(n(146)),c=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),r(t,[{key:"_getControlsForOperation",value:function(e){if(!e)return null;switch(e.constructor.identifier){case"mirrored-focus":return s.default;case"radial-focus":return l.default}}},{key:"renderWithBEM",value:function(){var e=this.getSharedState("operation"),t=this._getControlsForOperation(e);return t?o.ReactBEM.createElement(t,this.props):o.ReactBEM.createElement("div",null)}}]),t}();t.default=c,c.contextTypes=a.default.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(6)),s=i(n(11)),l=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return a._bindAll("_onCenterDragStart","_onCenterDrag","_onKnobDragStart","_onKnobDrag","_onOperationUpdated"),a.state={areaPosition:new o.Vector2,areaDimensions:new o.Vector2,knobPosition:new o.Vector2},a._operation=a.getSharedState("operation"),a._events=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},o.Constants.EVENTS.OPERATION_UPDATED,a._onOperationUpdated),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.default),r(t,[{key:"_onCanvasZoomDone",value:function(){this._setStylesFromOptions()}},{key:"_onOperationUpdated",value:function(e){e===this.getSharedState("operation")&&this._setStylesFromOptions()}},{key:"sharedStateDidChange",value:function(e){e.operation&&(this._operation=e.operation,"mirrored-focus"===this._operation.constructor.identifier&&this._setStylesFromOptions())}},{key:"componentDidMount",value:function(){var e=this;(function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this);var n=this.context.editor;n.zoom.set("auto",function(){n.features.disable("zoom","drag"),e._setStylesFromOptions()})}},{key:"_onCenterDragStart",value:function(){this._initialStart=this._operation.getStart(),this._initialEnd=this._operation.getEnd(),this._initialDist=this._initialEnd.clone().subtract(this._initialStart)}},{key:"_onCenterDrag",value:function(e){var t=this.context.editor,n=t.getOutputDimensions(),i=e.clone().divide(n),r=this._initialStart.clone().add(i).clamp(new o.Vector2(0,0),new o.Vector2(1,1).subtract(this._initialDist)),a=r.clone().add(this._initialDist);this._operation.set({start:r,end:a}),t.render(),this._setStylesFromOptions(),this.forceUpdate()}},{key:"_onKnobDragStart",value:function(e){this._initialKnobPosition=this.state.knobPosition.clone()}},{key:"_onKnobDrag",value:function(e){var t=this.context.editor,n=t.getOutputDimensions(),i=this._initialKnobPosition.clone().add(e).clamp(new o.Vector2(0,0),n),r=i.clone().subtract(this.state.areaPosition),a=this.state.areaPosition.clone().add(-r.y,r.x).divide(n),s=this.state.areaPosition.clone().add(r.y,-r.x).divide(n),l=2*r.len();this._operation.set({start:a,end:s,size:l/n.min(),gradientSize:l/n.min()}),this.setState({knobPosition:i,areaDimensions:new o.Vector2(this.state.areaDimensions.x,l)}),t.render()}},{key:"_getAreaStyle",value:function(){var e=this.state.knobPosition.clone().subtract(this.state.areaPosition),t="rotate("+(-Math.atan2(e.x,e.y)*(180/Math.PI)).toFixed(2)+"deg)";return{width:this.state.areaDimensions.x,height:this.state.areaDimensions.y,left:this.state.areaPosition.x,top:this.state.areaPosition.y,marginLeft:-.5*this.state.areaDimensions.x,marginTop:-.5*this.state.areaDimensions.y,transform:t,MozTransform:t,msTransform:t,WebkitTransform:t}}},{key:"_getKnobStyle",value:function(){return{left:this.state.knobPosition.x,top:this.state.knobPosition.y}}},{key:"_setStylesFromOptions",value:function(){var e=this.context.editor.getOutputDimensions(),t=this._operation.getStart().clone().multiply(e),n=this._operation.getEnd().clone().multiply(e),i=this._operation.getSize()*e.min(),r=n.clone().subtract(t),a=t.clone().add(r.clone().divide(2)),s=new o.Vector2(2*e.len(),i),l=r.len(),c=r.clone().divide(l).divide(2);this.setState({areaDimensions:s,areaPosition:a.clone(),knobPosition:a.clone().add(-i*c.y,i*c.x)})}},{key:"_getContainerStyle",value:function(){var e=this.context.editor.getSDK().getSprite().getBounds();return{left:e.x,top:e.y,width:e.width,height:e.height}}},{key:"renderWithBEM",value:function(){return o.ReactBEM.createElement("div",{bem:"b:canvasControls e:container m:full",ref:"container",style:this._getContainerStyle()},o.ReactBEM.createElement("div",{bem:"$b:linearFocusCanvasControls"},o.ReactBEM.createElement(a.default,{onStart:this._onCenterDragStart,onDrag:this._onCenterDrag},o.ReactBEM.createElement("div",{bem:"e:area",style:this._getAreaStyle()})),o.ReactBEM.createElement(a.default,{onStart:this._onKnobDragStart,onDrag:this._onKnobDrag},o.ReactBEM.createElement("div",{bem:"e:knob $b:knob",style:this._getKnobStyle()}))))}}]),t}();t.default=l,l.contextTypes=s.default.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(6)),s=i(n(11)),l=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return a._bindAll("_onCenterDragStart","_onCenterDrag","_onKnobDragStart","_onKnobDrag","_onOperationUpdated"),a.state={areaPosition:new o.Vector2,areaDimensions:new o.Vector2,knobPosition:new o.Vector2},a._knobChangedManually=!1,a._operation=a.getSharedState("operation"),a._events=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},o.Constants.EVENTS.OPERATION_UPDATED,a._onOperationUpdated),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.default),r(t,[{key:"_onCanvasZoomDone",value:function(){this._setStylesFromOptions()}},{key:"_onOperationUpdated",value:function(e){e===this.getSharedState("operation")&&(this._knobChangedManually=!1,this._setStylesFromOptions())}},{key:"sharedStateDidChange",value:function(e){e.operation&&(this._operation=e.operation,"radial-focus"===this._operation.constructor.identifier&&this._setStylesFromOptions())}},{key:"componentDidMount",value:function(){var e=this;(function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this);var n=this.context.editor;n.zoom.set("auto",function(){n.features.disable("zoom","drag"),e._setStylesFromOptions()})}},{key:"_onCenterDragStart",value:function(){this._initialPosition=this._operation.getPosition(),this._initialKnobPosition=this.state.knobPosition.clone()}},{key:"_onCenterDrag",value:function(e){var t=this.context.editor,n=t.getOutputDimensions(),i=e.clone().divide(n),r=this._initialPosition.clone().add(i),o=this._initialKnobPosition.clone().add(e);this._operation.set({position:r}),this.state.knobPosition=o,t.render(),this._setStylesFromOptions()}},{key:"_onKnobDragStart",value:function(e){this._knobChangedManually=!0,this._initialKnobPosition=this.state.knobPosition.clone()}},{key:"_onKnobDrag",value:function(e){var t=this.context.editor,n=t.getOutputDimensions(),i=this._initialKnobPosition.clone().add(e).clamp(new o.Vector2(0,0),n),r=this._operation.getPosition().clone().multiply(n),a=i.clone().subtract(r).abs().len(),s=a/2;this.setState({knobPosition:i,areaDimensions:new o.Vector2(2*a,2*a)}),this._operation.set({radius:a/n.min(),gradientRadius:s/n.min()}),t.render()}},{key:"_getAreaStyle",value:function(){return{width:this.state.areaDimensions.x,height:this.state.areaDimensions.y,left:this.state.areaPosition.x,top:this.state.areaPosition.y,marginLeft:-.5*this.state.areaDimensions.x,marginTop:-.5*this.state.areaDimensions.y}}},{key:"_getKnobStyle",value:function(){return{left:this.state.knobPosition.x,top:this.state.knobPosition.y}}},{key:"_setStylesFromOptions",value:function(){var e=this.context.editor.getOutputDimensions(),t=this._operation.getPosition().clone().multiply(e),n=this._operation.getRadius()*e.min(),i=2*n,r={areaDimensions:new o.Vector2(i,i),areaPosition:t};this._knobChangedManually||(r.knobPosition=t.clone().add(n,0)),this.setState(r)}},{key:"_getContainerStyle",value:function(){var e=this.context.editor.getSDK().getSprite().getBounds();return{left:e.x,top:e.y,width:e.width,height:e.height}}},{key:"renderWithBEM",value:function(){return o.ReactBEM.createElement("div",{bem:"b:canvasControls e:container m:full",ref:"container",style:this._getContainerStyle()},o.ReactBEM.createElement("div",{bem:"$b:radialFocusCanvasControls"},o.ReactBEM.createElement(a.default,{onStart:this._onCenterDragStart,onDrag:this._onCenterDrag},o.ReactBEM.createElement("div",{bem:"e:area",style:this._getAreaStyle()})),o.ReactBEM.createElement(a.default,{onStart:this._onKnobDragStart,onDrag:this._onKnobDrag},o.ReactBEM.createElement("div",{bem:"e:knob $b:knob",style:this._getKnobStyle()}))))}}]),t}();t.default=l,l.contextTypes=s.default.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(4)),s=i(n(148)),l=i(n(150)),c=o.SDK.Operations.SpriteOperation,u=c.StickerSprite,f=c.BrushSprite,p=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),r(t,null,[{key:"onExit",value:function(){var e=this.context.editor,t=this.getSharedState("operation");this.getSharedState("skipHistory")||e.history.add(t,this.getSharedState("initialOptions"),this.getSharedState("operationExistedBefore")),e.zoom.restore(),e.features.enable("zoom","drag"),e.render()}},{key:"onEnter",value:function(e){var t=this.context.editor,n=t.operations.exists("sprite"),i=t.operations.getOrCreate("sprite"),r=i.getSprites(),o=i.getSpritesOfType(u),a=i.serializeOptions();t.zoom.save(),t.zoom.set("auto"),t.features.disable("zoom","drag"),this.setSharedState({operationExistedBefore:n,operation:i,sprites:r,stickers:o,initialOptions:a})}},{key:"clickAtPosition",value:function(e,t){if(!t.operations.exists("sprite"))return!1;var n=t.operations.getOrCreate("sprite").getSpritesAtPosition(e,t.getOutputTextureDimensions()).filter(function(e){return!(e instanceof f)});return!!(n.length&&n[0]instanceof u)&&{selectedSprite:n[0]}}},{key:"isAvailable",value:function(e){return e.isToolAllowed("sticker")&&e.isToolEnabled("sticker")}}]),t}();p.controlsComponent=s.default,p.canvasControlsComponent=l.default,p.identifier="sticker",p.iconPath="controls/overview/sticker.png",p.languageKey="pesdk.sticker.title.name",p.defaultOptions={categories:null,replaceCategories:!1,availableStickers:null,tooltips:!1,hideCategories:!1,fixedRatio:!0,smoothDownscaling:!1},p.requiredOperations=["sprite"],p.getPreloadAssets=a.default.getPreloadAssets,t.default=p},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(0),s=i(n(3)),l=i(n(2)),c=i(n(43)),u=i(n(1)),f=i(n(12)),p=i(n(149)),d=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._bindAll("_onStickerMouseLeave","_renderTooltipCanvas","_onCategoryChange","_onBeforeHistoryUndo"),o._events=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},a.Constants.EVENTS.HISTORY_BEFORE_UNDO,o._onBeforeHistoryUndo),o._operation=o.getSharedState("operation"),o._sprites=o.getSharedState("sprites"),o._stickers=o.getSharedState("stickers"),o._initStickerManager(),o.state={category:o._stickerManager.getCategory(o.props.options.defaultCategory||"all")},o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.default),o(t,[{key:"_onBeforeHistoryUndo",value:function(e){var t=e.operation,n=e.options;t===this.getSharedState("operation")&&-1===n.sprites.indexOf(this.getSharedState("selectedSprite"))&&(this.setSharedState({skipHistory:!0},!1),this.props.onSwitchControls("home"))}},{key:"_onCategoryChange",value:function(e){var t=this;this.setState({category:e},function(){t.refs.scrollbar.update()})}},{key:"componentDidMount",value:function(){(function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this),this.props.options.stickersJSONPath&&this._loadExternalStickers();var e=this.context.editor;e.zoom.set("auto",function(){e.features.disable("zoom","drag")})}},{key:"_loadExternalStickers",value:function(){var e=this,t=null,n=setTimeout(function(){t=u.default.instance.displayLoading(e._t("pesdk.common.text.loading"))},100),i=function(){n&&(clearTimeout(n),n=null),t&&t.close(),e._jsonLoaded=!0};this._stickerManager.loadExternal(this.props.options.stickersJSONPath).then(function(t){i(),e.forceUpdate(function(){e.refs.scrollbar.update()})}).catch(function(t){i(),u.default.instance.displayError(e._t("pesdk.sticker.title.loadingStickersFailed"),t.message).on("close",function(){e.props.onBack()})})}},{key:"_renderTooltipCanvas",value:function(){var e=this,t=this.state.hoveredSticker,n=new window.Image,i=t.images.mediaBase;n.addEventListener("load",function(){if(e.state.tooltipVisible&&e.state.hoveredSticker===t){void 0!==i.width&&void 0!==i.height&&(n.width=i.width,n.height=i.height);var r=e.refs.tooltipCanvas;r.width=r.offsetWidth,r.height=r.offsetHeight;var o=r.getContext("2d"),s=Math.min(r.width/n.width,r.height/n.height),l=new a.Vector2(n.width,n.height).multiply(s),c=new a.Vector2(r.width,r.height).divide(2).subtract(l.clone().divide(2));o.drawImage(n,0,0,n.width,n.height,c.x,c.y,l.x,l.y)}});var r=this._getAssetPath(f.default.getURLForSticker(t,"base"));n.crossOrigin=this.context.editor.getCrossOrigin(),n.src=r}},{key:"_initStickerManager",value:function(){this._stickerManager=new f.default(this.context.ui,this.props.options)}},{key:"_onBackClick",value:function(e){this._backButtonClicked=!0,this.props.onSwitchControls("home"),e.preventDefault()}},{key:"_onStickerClick",value:function(e){var t=this,n=e.images.mediaBase,i=f.default.getURLForSticker(e,"base"),r=this._getAssetPath(i),o=new window.Image,s=void 0,l=setTimeout(function(){s=u.default.instance.displayLoading(t._t("pesdk.common.text.loading"))},100);o.addEventListener("load",function(){s&&s.close(),l&&(clearTimeout(l),l=null),void 0!==n.width&&void 0!==n.height&&(o.width=n.width,o.height=n.height);var i=t.context.editor,r=t._calculateInitialStickerScale(e,o),c=t._operation.createSticker({identifier:e.identifier,image:o,position:new a.Vector2(.5,.5),dimensions:new a.Vector2(o.width,o.height).multiply(r),rotation:0,smoothDownscaling:t.props.options.smoothDownscaling});t._operation.addSprite(c),t._stickers.push(c),i.render(function(){t.setSharedState({selectedSprite:c,sprites:t._sprites,stickers:t._stickers})})}),o.addEventListener("error",function(){s&&s.close(),l&&(clearTimeout(l),l=null),u.default.instance.displayError(t._t("pesdk.common.title.imageLoadFail"),t._t("pesdk.common.text.imageLoadFail",{path:o.src}))}),o.crossOrigin=this.context.editor.getCrossOrigin(),o.src=r}},{key:"_calculateInitialStickerScale",value:function(e,t){var n=this.getSharedState("operation").getInputDimensions(!1),i=new a.Vector2(t.width,t.height);return a.SDKUtils.resizeVectorToFit(i,n.clone().multiply(.5)).x/i.x}},{key:"_onStickerMouseEnter",value:function(e,t){var n=this;this.setState({tooltipVisible:!0,hoveredSticker:e,hoveredStickerElement:t.currentTarget},function(){n._renderTooltipCanvas(),n._updateTooltipPosition()})}},{key:"_updateTooltipPosition",value:function(){var e=this.state.hoveredStickerElement,t=this.refs.root,n=e.getBoundingClientRect(),i=t.getBoundingClientRect();this.setState({tooltipPosition:n.left-i.left})}},{key:"_onStickerMouseLeave",value:function(){this.setState({tooltipVisible:!1,hoveredSticker:null})}},{key:"_renderListItems",value:function(){var e=this,t=this.props.options,n=t.stickersJSONPath,i=t.replaceCategories;if(!n||!i||this._jsonLoaded)return this._stickerManager.getStickersForCategory(this.state.category.identifier).map(function(t,n){var i=e.props.options.tooltips?{onMouseEnter:e._onStickerMouseEnter.bind(e,t),onMouseLeave:e._onStickerMouseLeave}:null;return a.ReactBEM.createElement(p.default,r({sticker:t,onClick:e._onStickerClick.bind(e,t)},i))})}},{key:"_renderTooltip",value:function(){var e=this.props.options.tooltips&&this.state.tooltipVisible,t={left:this.state.tooltipPosition};return e?a.ReactBEM.createElement("div",{bem:"e:cell m:empty"},a.ReactBEM.createElement("div",{bem:"$b:stickersControls $e:tooltip",style:t},a.ReactBEM.createElement("canvas",{bem:"e:canvas",ref:"tooltipCanvas"}))):null}},{key:"_renderCategoryDropdown",value:function(){var e=this,t=this.props.options,n=t.stickersJSONPath,i=t.replaceCategories;if(!n||!i||this._jsonLoaded){var r=this._stickerManager.getCategories(!0);if(this.props.options.hideCategories||!(r.length>1))return null;var o=r.map(function(t){return{identifier:t.identifier,item:t,label:e._t("pesdk.sticker.asset."+t.identifier)||t.defaultName,icon:e._getAssetPath("controls/stickers/categories/"+t.identifier+".png",!0)}}),s=this.state.category,l={identifier:s.identifier,item:s,label:this._t("pesdk.sticker.asset."+s.identifier)||s.defaultName,icon:this._getAssetPath("controls/stickers/categories/"+s.identifier+".png",!0)};return a.ReactBEM.createElement("div",{bem:"e:cell m:categoryDropdown"},a.ReactBEM.createElement(c.default,{items:o,selectedItem:l,onChange:this._onCategoryChange}))}}},{key:"renderControls",value:function(){var e=this._renderListItems();return[this._renderTooltip(),this._renderCategoryDropdown(),a.ReactBEM.createElement("div",{bem:"e:cell m:list"},a.ReactBEM.createElement(l.default,{ref:"scrollbar"},a.ReactBEM.createElement("ul",{bem:"$e:list"},e)))]}}]),t}();t.default=d,d.contextTypes=s.default.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(12)),a=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o.state={sticker:o.props.sticker},o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"componentDidMount",value:function(){this._renderSticker()}},{key:"componentWillReceiveProps",value:function(e){var t=this;this.props.sticker!==e.sticker&&this.setState({sticker:e.sticker},function(){t._renderSticker()})}},{key:"_renderSticker",value:function(){var e=this.context.editor.getSDK(),t=this.props.sticker,n=t.images.mediaThumb,i=o.default.getURLForSticker(t,"thumb"),a=this._getAssetPath(i),s=this.refs["canvas-"+t.name],l=e.getPixelRatio();s.width=s.offsetWidth*l,s.height=s.offsetHeight*l,s.style.width=s.offsetWidth+"px",s.style.height=s.offsetHeight+"px";var c=s.getContext("2d"),u=new window.Image;u.addEventListener("load",function(){void 0===n.width||void 0===n.height||r.Utils.Browser.getIEVersion()||(u.width=n.width,u.height=n.height);var e=Math.min(s.width/u.width,s.height/u.height),t=new r.Vector2(u.width,u.height).multiply(e),i=new r.Vector2(s.width,s.height).divide(2).subtract(t.clone().divide(2));c.drawImage(u,0,0,u.width,u.height,i.x,i.y,t.x,t.y)}),u.crossOrigin=this.context.editor.getCrossOrigin(),u.src=a}},{key:"renderWithBEM",value:function(){return r.ReactBEM.createElement("li",{bem:"$b:stickersControls $e:item",key:this.props.sticker.name,onClick:this.props.onClick,onMouseEnter:this.props.onMouseEnter,onMouseLeave:this.props.onMouseLeave},r.ReactBEM.createElement("canvas",{bem:"e:canvas",ref:"canvas-"+this.props.sticker.name}))}}]),t}();t.default=a},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(16)),s=i(n(154)),l=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),r(t,[{key:"_renderOverlayControls",value:function(){if(this.getSharedState("selectedSprite"))return o.ReactBEM.createElement(s.default,{onFlip:this._onSpriteFlip,onTakeToFront:this._onSpriteTakeToFront,onRemove:this._onSpriteRemove})}}]),t}();t.default=l,l.contextTypes=a.default.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(6)),s=i(n(28)),l=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._bindAll("_onTextChange","_onItemDoubleClick","_onItemTouchStart","_onItemTouchEnd","_onResizeKnobDragStart","_onResizeKnobDrag","_onResizeKnobDragStop","_onRotationKnobDragStart","_onRotationKnobDrag","_onRotationKnobDragStop","_onBlur"),o.state={editMode:!1,text:o.props.sprite.getText()},o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.default),r(t,[{key:"componentWillReceiveProps",value:function(e){(function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentWillReceiveProps",this).call(this,e),e.sprite!==this.props.sprite&&(this.refs.textarea.blur(),this.setState({text:e.sprite.getText(),editMode:!1}))}},{key:"_onTextChange",value:function(e){this.props.sprite.setText(e.target.value),this.setState({text:e.target.value})}},{key:"_onItemDoubleClick",value:function(){this.enterEditMode()}},{key:"enterEditMode",value:function(){var e=this,t=this.props.sprite,n=this.context.editor;t.setVisible(!1),t._edited||(t.setText(""),this.refs.textarea.value="",t._edited=!0,this.setState({text:""})),this.setState({editMode:!0},function(){e.refs.textarea.focus(),e.refs.textarea.select()}),n.render()}},{key:"leaveEditMode",value:function(){var e=this.props.sprite,t=this.context.editor;e.setVisible(!0),t.render(),this.setState({editMode:!1})}},{key:"_onItemTouchStart",value:function(e){this._initialTouchPosition=o.Utils.getEventPosition(e),this._tapStartAt=(0,o.now)()}},{key:"_onItemTouchEnd",value:function(){(0,o.now)()-this._tapStartAt<=100&&(void 0!==this._lastTapAt&&(0,o.now)()-this._lastTapAt<=300&&this._onItemDoubleClick(),this._lastTapAt=(0,o.now)())}},{key:"_onRotationKnobDragStart",value:function(e,t){this._dragging=!0,this._initialPosition=this._getRotationKnobPosition(),this.props.onDragStart&&this.props.onDragStart()}},{key:"_onRotationKnobDrag",value:function(e,t){var n=this.props.sprite,i=this.context.editor,r=this._getAbsoluteSpritePosition(),o=this._initialPosition.clone().add(e).clone().subtract(r),a=n.getDimensions(i.getSDK(),i.getOutputDimensions()),s=Math.atan2(o.y/2,o.x/2)-Math.atan2(a.y/2,a.x/2);n.setRotation(s),i.render(),this.forceUpdate()}},{key:"_onRotationKnobDragStop",value:function(e){this.props.onDragStop&&this.props.onDragStop()}},{key:"_onResizeKnobDragStart",value:function(e,t){this._initialPosition=this._getResizeKnobPosition(),this.props.onDragStart&&this.props.onDragStart()}},{key:"_onResizeKnobDrag",value:function(e,t){var n=this.props.sprite,i=n.getRotation(),r=this.context.editor,o=r.getOutputDimensions(),a=Math.cos(i),s=Math.sin(i),l=this._initialPosition.clone().add(e),c=this._getAbsoluteSpritePosition(),u=l.clone().subtract(c),f=Math.max((u.x*a+u.y*s)/o.x*2,.1);n.setMaxWidth(f),r.render()}},{key:"_onResizeKnobDragStop",value:function(e){this.props.onDragStop&&this.props.onDragStop()}},{key:"_onBlur",value:function(){this.leaveEditMode()}},{key:"_getRotationKnobStyle",value:function(){var e=this._getRotationKnobPosition();return{left:e.x,top:e.y}}},{key:"_getResizeKnobStyle",value:function(){var e=this._getResizeKnobPosition();return{left:e.x,top:e.y}}},{key:"_getTextStyle",value:function(){var e=this.context.editor,t=this.props.sprite,n=e.getSDK(),i=e.getOutputDimensions(),r=t.getDOMStyle(n,i),o=this._getAbsoluteSpritePosition(),a=t.getDimensions(n,i);return r.height=Math.min(a.y,i.y-o.y),this.state.editMode||(r.display="none"),r}},{key:"_getItemContainerStyle",value:function(){var e=this.context.editor,t=this.props.sprite,n=e.getOutputDimensions(),i=t.getDimensions(e.getSDK(),n),r=t.getPosition().clone().multiply(n),o="rotateZ("+(180*t.getRotation()/Math.PI).toFixed(2)+"deg)",a=i.x,s=i.y;return{width:a,height:s,left:r.x-.5*a,top:r.y-.5*s,marginLeft:0,marginTop:0,transform:o,MozTransform:o,msTransform:o,WebkitTransform:o,transformOrigin:"50% 50%",MozTransformOrigin:"50% 50%",msTransformOrigin:"50% 50%",WebkitTransformOrigin:"50% 50%"}}},{key:"_getRotationKnobPosition",value:function(){var e=this.props.sprite,t=this.context.editor,n=Math.sin(e.getRotation()),i=Math.cos(e.getRotation()),r=t.getOutputDimensions(),o=e.getDimensions(t.getSDK(),r).clone().divide(2);return e.getPosition().clone().multiply(r).add(o.x*i-o.y*n,o.x*n+o.y*i)}},{key:"_getResizeKnobPosition",value:function(){var e=this.props.sprite,t=this.context.editor,n=Math.sin(e.getRotation()),i=Math.cos(e.getRotation()),r=t.getOutputDimensions(),o=e.getDimensions(t.getSDK(),r).clone().divide(2);return e.getPosition().clone().multiply(r).add(o.x*i+o.y*n,o.x*n-o.y*i)}},{key:"_renderKnobs",value:function(){var e=[];return this.props.selected&&!this.state.editMode&&(e=[o.ReactBEM.createElement(a.default,{onStart:this._onRotationKnobDragStart,onDrag:this._onRotationKnobDrag,onStop:this._onRotationKnobDragStop},o.ReactBEM.createElement("div",{bem:"e:knob m:rotate $b:knob",style:this._getRotationKnobStyle()},o.ReactBEM.createElement("img",{bem:"e:icon m:larger",src:this._getAssetPath("controls/knobs/rotate.png",!0)}))),o.ReactBEM.createElement(a.default,{onStart:this._onResizeKnobDragStart,onDrag:this._onResizeKnobDrag,onStop:this._onResizeKnobDragStop},o.ReactBEM.createElement("div",{bem:"e:knob m:resize $b:knob",style:this._getResizeKnobStyle()},o.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("controls/knobs/resize-diagonal-up.png",!0)})))]),e}},{key:"_renderItem",value:function(){var e=this._getItemContainerStyle(),t=o.ReactBEM.createElement("textarea",{bem:"e:content",ref:"textarea",style:this._getTextStyle(),value:this.state.text,disabled:!this.state.editMode,onBlur:this._onBlur,onChange:this._onTextChange});return o.ReactBEM.createElement("bem",{specifier:"e:text"},o.ReactBEM.createElement("div",{bem:"e:container",style:e},t))}},{key:"_renderSelectedOverlay",value:function(){var e=[];this.props.selected&&e.push("is-selected"),this.state.editMode&&e.push("is-disabled"),e=e.join(" ");var t=this._getItemContainerStyle();return o.ReactBEM.createElement("bem",{specifier:"e:text"},o.ReactBEM.createElement(a.default,{onStart:this._onItemDragStart,onStop:this._onItemDragStop,onDrag:this._onItemDrag,disabled:!this.props.selected||this.props.selected&&this.state.editMode},o.ReactBEM.createElement("div",{bem:"e:selectedOverlay",onDoubleClick:this._onItemDoubleClick,onTouchStart:this._onItemTouchStart,onTouchEnd:this._onItemTouchEnd,style:t,className:e})))}},{key:"renderWithBEM",value:function(){return o.ReactBEM.createElement("bem",{specifier:"b:spritesCanvasControls"},o.ReactBEM.createElement("div",{bem:"$e:item e:container"},this._renderItem(),this._renderSelectedOverlay(),this._renderKnobs()))}}]),t}();t.default=l,l.contextTypes=s.default.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(6)),s=i(n(28)),l=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return a._bindAll("_onRotateKnobDragStart","_onRotateKnobDrag","_onRotateKnobDragStop"),a._id=o.SDKUtils.getUUID(),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.default),r(t,[{key:"_onKnobDragStart",value:function(e,t,n){var i=this.props.sprite;switch(e){case"bottom":this._initialPosition=this._getBottomDragKnobPosition();break;case"top":this._initialPosition=this._getTopDragKnobPosition()}this._initialDimensions=i.getDimensions().clone(),this.props.onDragStart&&this.props.onDragStart()}},{key:"_onKnobDrag",value:function(e,t,n){var i=this.props.sprite,r=this.context.editor,a=r.getOptions().editor,s=this._getAbsoluteSpritePosition(),l=this._initialPosition.clone().add(t).clone().subtract(s),c=this._initialPosition.clone().subtract(s);if(this.props.options.fixedRatio){var u=this._getStickerDimensions().divide(2).abs(),f=this._initialPosition.clone().subtract(s),p=void 0;switch(e){case"bottom":p=Math.atan2(l.y,l.x)-Math.atan2(u.y,u.x);break;case"top":p=Math.atan2(l.y,l.x)-Math.atan2(-u.y,-u.x)}var d=this._initialDimensions.clone().multiply(l.len()/f.len());if(a.enableRotationSnapping){var h=a.rotationSnapping.angles.map(function(e){return e*Math.PI/180}),_=a.rotationSnapping.threshold*Math.PI/180;p=this._mapPositionToSnapSystem(p,h,_)}i.set({dimensions:d,rotation:p})}else{var m=this.context.editor.zoom.get(),y=i.getRotation(),g=Math.cos(-1*y),v=Math.sin(-1*y),b=new o.Vector2(l.x*g-l.y*v,l.x*v+l.y*g),k=new o.Vector2(c.x*g-c.y*v,c.x*v+c.y*g),w=void 0;switch(e){case"bottom":w=b.clone().subtract(k);break;case"top":w=k.clone().subtract(b)}var O=this._initialDimensions.clone().add(w.clone().divide(m).multiply(2));i.set({dimensions:O})}r.render()}},{key:"_onKnobDragStop",value:function(){this.props.onDragStop&&this.props.onDragStop()}},{key:"_onRotateKnobDragStart",value:function(e,t){this._initialPosition=this._getRotateKnobPosition(),this.props.onDragStart&&this.props.onDragStart()}},{key:"_onRotateKnobDragStop",value:function(){this.props.onDragStop&&this.props.onDragStop()}},{key:"_onRotateKnobDrag",value:function(e,t){var n,i=this.props.sprite,r=this.context.editor,o=this._getAbsoluteSpritePosition(),a=this._initialPosition.clone().add(e),s=this._getStickerDimensions().divide(2),l=a.clone().subtract(o);n=Math.atan2(l.y,l.x)-Math.atan2(-s.y,s.x),i.set({rotation:n}),r.render()}},{key:"_getBottomDragKnobStyle",value:function(){var e=this._getBottomDragKnobPosition();return{left:e.x,top:e.y}}},{key:"_getTopDragKnobStyle",value:function(){var e=this._getTopDragKnobPosition();return{left:e.x,top:e.y}}},{key:"_getRotateKnobStyle",value:function(){var e=this._getRotateKnobPosition();return{left:e.x,top:e.y}}},{key:"_getStickerStyle",value:function(){var e=this.props.sprite,t=this._getStickerDimensions().abs(),n=this._getAbsoluteSpritePosition().subtract(t.clone().divide(2)),i="rotate("+(180*e.getRotation()/Math.PI).toFixed(2)+"deg)",r=e.getDimensions(),o=e.getFlipVertically();r.y<0&&(o=!o),o&&(i+=" scaleY(-1)");var a=e.getFlipHorizontally();return r.x<0&&(a=!a),a&&(i+=" scaleX(-1)"),{top:n.y,left:n.x,width:t.x,height:t.y,WebkitTransform:i,msTransform:i,MozTransform:i,OTransform:i}}},{key:"_getStickerDimensions",value:function(){var e=this.props.sprite,t=this.context.editor;return e.getDimensions().clone().multiply(t.zoom.get())}},{key:"_getRotateKnobPosition",value:function(){var e=this.props.sprite,t=this._getAbsoluteSpritePosition(),n=e.getRotation(),i=Math.sin(n||0),r=Math.cos(n||0),o=this._getStickerDimensions().divide(2);return t.clone().add(o.x*r+o.y*i,o.x*i-o.y*r)}},{key:"_getBottomDragKnobPosition",value:function(){var e=this.props.sprite,t=this._getAbsoluteSpritePosition(),n=e.getRotation(),i=Math.sin(n||0),r=Math.cos(n||0),o=this._getStickerDimensions().divide(2);return t.clone().add(o.x*r-o.y*i,o.x*i+o.y*r)}},{key:"_getTopDragKnobPosition",value:function(){var e=this.props.sprite,t=this._getAbsoluteSpritePosition(),n=e.getRotation(),i=Math.sin(n||0),r=Math.cos(n||0),o=this._getStickerDimensions(e).divide(2);return t.clone().subtract(o.x*r-o.y*i,o.x*i+o.y*r)}},{key:"_renderKnobs",value:function(){var e=[];return this.props.selected&&(e=[o.ReactBEM.createElement(a.default,{onStart:this._onKnobDragStart.bind(this,"bottom"),onStop:this._onKnobDragStop.bind(this,"bottom"),onDrag:this._onKnobDrag.bind(this,"bottom")},o.ReactBEM.createElement("div",{bem:"e:knob $b:knob",style:this._getBottomDragKnobStyle()},o.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("controls/knobs/resize-diagonal-down.png",!0)}))),o.ReactBEM.createElement(a.default,{onStart:this._onKnobDragStart.bind(this,"top"),onStop:this._onKnobDragStop.bind(this,"top"),onDrag:this._onKnobDrag.bind(this,"top")},o.ReactBEM.createElement("div",{bem:"e:knob $b:knob",style:this._getTopDragKnobStyle()},o.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("controls/knobs/resize-diagonal-down.png",!0)})))],this.props.options.fixedRatio||e.push(o.ReactBEM.createElement(a.default,{onStart:this._onRotateKnobDragStart,onStop:this._onRotateKnobDragStop,onDrag:this._onRotateKnobDrag},o.ReactBEM.createElement("div",{bem:"e:knob $b:knob",style:this._getRotateKnobStyle()},o.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("controls/knobs/rotate.png",!0)}))))),e}},{key:"_renderSVGFilter",value:function(){if(this.props.hideContent)return null;var e=this.props.sprite.getAdjustments(),t=e.getBrightness(),n=e.getSaturation(),i=e.getContrast(),r="<filter id='pesdk-sticker-"+this._id+"-filter'>\n        <feComponentTransfer>\n          <feFuncR type='linear' intercept='"+t+"' />\n          <feFuncG type='linear' intercept='"+t+"' />\n          <feFuncB type='linear' intercept='"+t+"' />\n        </feComponentTransfer>\n        <feColorMatrix type='saturate' values='"+n+"' />\n        <feComponentTransfer>\n          <feFuncR type='linear' slope='"+i+"' intercept='"+(-.5*i+.5)+"' />\n          <feFuncG type='linear' slope='"+i+"' intercept='"+(-.5*i+.5)+"' />\n          <feFuncB type='linear' slope='"+i+"' intercept='"+(-.5*i+.5)+"' />\n        </feComponentTransfer>\n      </filter>";return o.ReactBEM.createElement("svg",{width:"0",height:"0","color-interpolation-filters":"sRGB",is:"svg"},o.ReactBEM.createElement("defs",{key:Math.random(),dangerouslySetInnerHTML:{__html:r}}))}},{key:"_renderSelectedOverlay",value:function(){var e=[];this.props.selected&&e.push("is-selected"),e=e.join(" ");var t=this._getStickerStyle();return o.ReactBEM.createElement("bem",{specifier:"e:text"},o.ReactBEM.createElement(a.default,{onStart:this._onItemDragStart,onStop:this._onItemDragStop,onDrag:this._onItemDrag,disabled:!this.props.selected},o.ReactBEM.createElement("div",{bem:"e:selectedOverlay",onDoubleClick:this._onItemDoubleClick,onTouchStart:this._onItemTouchStart,onTouchEnd:this._onItemTouchEnd,style:t,className:e})))}},{key:"_renderItem",value:function(){if(this.props.hideContent)return null;var e=this.props.sprite,t=this._getStickerStyle(),n={filter:'url("'+window.location.href.replace(window.location.hash,"")+"#pesdk-sticker-"+this._id+'-filter")'},i={width:t.width,height:t.height};return o.ReactBEM.createElement("bem",{specifier:"e:sticker"},o.ReactBEM.createElement("div",{bem:"e:container",style:t},o.ReactBEM.createElement("svg",{width:parseInt(t.width),height:parseInt(t.height),"color-interpolation-filters":"sRGB",is:"svg",style:i,preserveAspectRatio:"none"},o.ReactBEM.createElement("image",{xlinkHref:e.getImage().src,width:t.width,height:t.height,style:n,preserveAspectRatio:"none"}))))}},{key:"renderWithBEM",value:function(){return o.ReactBEM.createElement("bem",{specifier:"b:spritesCanvasControls"},o.ReactBEM.createElement("div",{bem:"$e:item e:container"},this._renderSVGFilter(),this._renderItem(),this._renderSelectedOverlay(),this._renderKnobs()))}}]),t}();t.default=l,l.contextTypes=s.default.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(28)),a=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),i(t,[{key:"componentDidMount",value:function(){if(function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this),!this.props.hideContent){var e=this.props.sprite.getCanvas();this._appendCanvas(e)}}},{key:"componentWillReceiveProps",value:function(e){if(!this.props.hideContent&&e.sprite!==this.props.sprite){var t=this.props.sprite.getCanvas();t.parentNode.removeChild(t);var n=e.sprite.getCanvas();this._appendCanvas(n)}}},{key:"_isSelected",value:function(){return this.getSharedState("brush")===this.props.sprite}},{key:"_appendCanvas",value:function(e){var t=this.context.editor.getOutputDimensions();e.style.width=t.x+"px",e.style.height=t.y+"px",this.refs.brush.appendChild(e)}},{key:"renderWithBEM",value:function(){if(this.props.hideContent)return null;var e=this._isSelected()?"is-selected":null;return r.ReactBEM.createElement("bem",{specifier:"b:spritesCanvasControls"},r.ReactBEM.createElement("div",{bem:"$e:item e:container m:full",ref:"container"},r.ReactBEM.createElement("div",{bem:"$e:brush",className:e,ref:"brush"})))}}]),t}();t.default=a,a.contextTypes=o.default.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"_onFlipClick",value:function(e,t){t.preventDefault(),t.stopPropagation(),this.props.onFlip&&this.props.onFlip(e)}},{key:"_onTakeToFrontClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.props.onTakeToFront&&this.props.onTakeToFront()}},{key:"_onRemoveClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.props.onRemove&&this.props.onRemove()}},{key:"_renderItems",value:function(){return[r.ReactBEM.createElement("div",{bem:"$e:item",onClick:this._onFlipClick.bind(this,"h")},r.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("controls/sprites/flip-h.png",!0)})),r.ReactBEM.createElement("div",{bem:"$e:item",onClick:this._onFlipClick.bind(this,"v")},r.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("controls/sprites/flip-v.png",!0)})),r.ReactBEM.createElement("div",{bem:"$e:item",onClick:this._onTakeToFrontClick.bind(this)},r.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("controls/sprites/take-to-front.png",!0)})),r.ReactBEM.createElement("div",{bem:"$e:separator"}),r.ReactBEM.createElement("div",{bem:"$e:item",onClick:this._onRemoveClick.bind(this)},r.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("controls/sprites/remove.png",!0)}))]}},{key:"renderWithBEM",value:function(){return r.ReactBEM.createElement("div",{bem:"$b:spritesControlsOverlay"},this._renderItems())}}]),t}();t.default=o,o.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(4)),s=i(n(156)),l=i(n(158)),c=i(n(9)),u=o.SDK.Operations.SpriteOperation,f=u.TextSprite,p=u.BrushSprite,d=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),r(t,[{key:"saveTextSettings",value:function(){var e=this.getSharedState("selectedSprite");e&&this.setGlobalToolState("text",e.serializeOptions(["color","backgroundColor","characterSpacing","lineHeight","alignment","fontIdentifier","fontFamily","fontWeight","fontStyle"]))}}],[{key:"onExit",value:function(){var e=this.context.editor,t=this.getSharedState("operation");this.saveTextSettings(),this.getSharedState("skipHistory")||e.history.add(t,this.getSharedState("initialOptions"),this.getSharedState("operationExistedBefore")),e.zoom.restore(),e.features.enable("zoom","drag"),e.render()}},{key:"onEnter",value:function(e,t){var n=this.context,i=n.editor,r=n.ui,o=i.operations.exists("sprite"),a=i.operations.getOrCreate("sprite"),s=a.getSprites(),l=a.serializeOptions(),u=new c.default(r,t),f=u.getDefaultVariation();this.setSharedState({operationExistedBefore:o,operation:a,sprites:s,initialOptions:l,fontManager:u,defaultFontVariation:f,fonts:u.getFonts()}),i.zoom.save(),i.render()}},{key:"clickAtPosition",value:function(e,t){if(!t.operations.exists("sprite"))return!1;var n=t.operations.getOrCreate("sprite").getSpritesAtPosition(e,t.getOutputTextureDimensions()).filter(function(e){return!(e instanceof p)});return!!(n.length&&n[0]instanceof f)&&{selectedSprite:n[0]}}},{key:"isAvailable",value:function(e){return e.isToolAllowed("text")&&e.isToolEnabled("text")}},{key:"getPreloadAssets",value:function(e){return["controls/text/align_left.png","controls/text/align_right.png","controls/text/align_center.png","controls/text/minus.png","controls/text/plus.png"]}}]),t}();d.controlsComponent=l.default,d.canvasControlsComponent=s.default,d.identifier="text",d.iconPath="controls/overview/text.png",d.languageKey="pesdk.text.title.name",d.defaultOptions={fonts:[],replaceFonts:!1,availableVariations:null},d.requiredOperations=["sprite"],t.default=d},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(16)),s=i(n(157)),l=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._bindAll("_onTextEdit"),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),r(t,[{key:"_onItemBlur",value:function(){var e=this.getSharedState("selectedSprite");e&&""===e.getText()&&(e.setText(this._t("pesdk.text.placeholder.defaultText")),e._edited=!1)}},{key:"_onSpriteRemove",value:function(){(function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_onSpriteRemove",this).call(this),this.props.onSwitchControls("home")}},{key:"_onTextEdit",value:function(){var e=this.getSharedState("selectedSprite");this.refs["sprite-"+e.getId()].enterEditMode()}},{key:"_renderOverlayControls",value:function(){if(this.getSharedState("selectedSprite"))return o.ReactBEM.createElement(s.default,{onTakeToFront:this._onSpriteTakeToFront,onRemove:this._onSpriteRemove,onEdit:this._onTextEdit})}}]),t}();t.default=l,l.contextTypes=a.default.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"_onEditClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.props.onEdit&&this.props.onEdit()}},{key:"_onTakeToFrontClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.props.onTakeToFront&&this.props.onTakeToFront()}},{key:"_onRemoveClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.props.onRemove&&this.props.onRemove()}},{key:"_renderItems",value:function(){var e=[r.ReactBEM.createElement("div",{bem:"$e:item",onClick:this._onTakeToFrontClick.bind(this)},r.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("controls/sprites/take-to-front.png",!0)}))];return r.Utils.isTouchDevice()&&(e=e.concat([r.ReactBEM.createElement("div",{bem:"$e:separator"}),r.ReactBEM.createElement("div",{bem:"$e:item",onClick:this._onEditClick.bind(this)},r.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("controls/sprites/edit.png",!0)}))])),e=e.concat([r.ReactBEM.createElement("div",{bem:"$e:separator"}),r.ReactBEM.createElement("div",{bem:"$e:item",onClick:this._onRemoveClick.bind(this)},r.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("controls/sprites/remove.png",!0)}))])}},{key:"renderWithBEM",value:function(){return r.ReactBEM.createElement("div",{bem:"$b:spritesControlsOverlay"},this._renderItems())}}]),t}();t.default=o,o.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(0),s=i(n(3)),l=i(n(2)),c=i(n(29)),u=i(n(7)),f=i(n(45)),p=i(n(163)),d=i(n(1)),h=["left","center","right"],_=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._bindAll("_onFontSizeChange","_onFontChange","_onAlignmentClick","_onTakeToFrontClick","_onForegroundColorChange","_onBackgroundColorChange","_onBeforeHistoryUndo"),o._events=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},a.Constants.EVENTS.HISTORY_BEFORE_UNDO,o._onBeforeHistoryUndo),o._operation=o.getSharedState("operation"),o._fontLoader=o.context.ui.getFontLoader(),o._fontLoader.setFonts(o.getSharedState("fonts")),o.state={mode:null,loading:!0},o.context.editor.render(),o._fonts=o.getSharedState("fonts"),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.default),o(t,[{key:"componentDidMount",value:function(){var e=this;(function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this);var n=this.context.editor;n.zoom.set("auto",function(){n.features.disable("zoom","drag")});var i=function(){e._createText(),e.setState({loading:!1})};this._fontLoader.needsToLoad()?this._loadFonts().then(i.bind(this)):i()}},{key:"_loadFonts",value:function(){var e=this,t=d.default.instance.displayLoading(this._t("pesdk.common.text.loading"));return this._fontLoader.load().then(function(){t.close()}).catch(function(n){t.close(),d.default.instance.displayWarning(e._t("pesdk.text.title.loadingFontsFailed"),e._t("pesdk.text.text.loadingFontsFailed"))})}},{key:"_createText",value:function(){var e=this.context.editor,t=this.getSharedState("selectedSprite"),n=this.getSharedState("operation"),i=this.getSharedState("fontManager"),o=this.getGlobalToolState("text"),s=o?this.getSharedState("defaultFontVariation"):i.getDefaultVariation(),l=e.getOutputDimensions();if(!t){var c=e.getSDK().getRenderer().getMaxTextureSize(),u=n.createText(r({fontIdentifier:s.getIdentifier(),text:this._t("pesdk.text.placeholder.defaultText"),position:new a.Vector2(.5,.5),pivot:new a.Vector2(.5,.5),maxWidth:.5,maxHeight:c?c/l.y:3,fontSize:.08,fontFamily:s.getFont().getFontFamily(),fontWeight:s.getFontWeight(),fontStyle:s.getFontStyle(),alignment:"center"},o||{}));n.addSprite(u),this.setSharedState({selectedSprite:u}),e.render()}}},{key:"_onBeforeHistoryUndo",value:function(e){var t=e.operation,n=e.options;t===this.getSharedState("operation")&&-1===n.sprites.indexOf(this.getSharedState("selectedSprite"))&&(this.setSharedState({skipHistory:!0},!1),this.props.onSwitchControls("home"))}},{key:"_onBackClick",value:function(e){var t=this.context.editor;this.saveTextSettings(),t.render(),this._backButtonClicked=!0,this.props.onSwitchControls("home"),e.preventDefault()}},{key:"saveTextSettings",value:function(){var e=this.getSharedState("selectedSprite");e&&this.setGlobalToolState("text",e.serializeOptions(["color","backgroundColor","characterSpacing","lineHeight","alignment","fontIdentifier","fontFamily","fontWeight","fontStyle"]))}},{key:"sharedStateDidChange",value:function(e){"selectedSprite"in e&&this.forceUpdate()}},{key:"_onFontSizeChange",value:function(e){var t=this.context.editor,n=this.context.editor.getOutputDimensions();this.getSharedState("selectedSprite").setFontSize(e/n.y),this.forceUpdate(),t.render()}},{key:"_onFontChange",value:function(e){var t=this.context.editor,n=this.getSharedState("selectedSprite");n.setFontFamily(e.getFont().getFontFamily()),n.setFontWeight(e.getFontWeight()),n.setFontStyle(e.getFontStyle()),n.setFontIdentifier(e.getIdentifier()),this.forceUpdate(),t.render()}},{key:"_onAlignmentClick",value:function(e){var t=this.context.editor,n=this.getSharedState("selectedSprite"),i=n.getAlignment(),r=(h.indexOf(i)+1)%h.length,o=h[r];n.setAlignment(o),this.forceSharedUpdate(),t.render()}},{key:"_onTakeToFrontClick",value:function(e){var t=this.context.editor;this.getSharedState("operation").takeSpriteToFront(this.getSharedState("selectedSprite")),this.forceSharedUpdate(),t.render()}},{key:"_onForegroundColorChange",value:function(e){var t=this.context.editor;this.getSharedState("selectedSprite").setColor(e),t.render()}},{key:"_onBackgroundColorChange",value:function(e){var t=this.context.editor;this.getSharedState("selectedSprite").setBackgroundColor(e),t.render()}},{key:"_switchToMode",value:function(e){e===this.state.mode&&(e=null),this.setState({mode:e})}},{key:"renderOverlayControls",value:function(){switch(this.state.mode){case"size":return this._renderFontSizeOverlayControl();case"font":return this._renderFontFamilyOverlayControl();default:return null}}},{key:"_renderFontSizeOverlayControl",value:function(){var e=this.getSharedState("selectedSprite");if(e){var t=this.context.editor.getOutputDimensions(),n=Math.round(t.y),i=Math.round(e.getFontSize()*t.y);return a.ReactBEM.createElement(u.default,{value:i,minValue:.05*t.y,maxValue:n,label:this._t("pesdk.text.button.size"),onChange:this._onFontSizeChange})}}},{key:"_renderSizeItem",value:function(){var e=this.getSharedState("selectedSprite");if(e){var t=this.context.editor.getOutputDimensions(),n=e.getFontSize(),i="size"===this.state.mode?"is-active":null;return a.ReactBEM.createElement("li",{bem:"e:item",key:"size"},a.ReactBEM.createElement("bem",{specifier:"$b:controls"},a.ReactBEM.createElement("div",{bem:"$e:button m:withLabel",className:i,"data-identifier":"fontSize",onClick:this._switchToMode.bind(this,"size")},a.ReactBEM.createElement("div",{bem:"b:fontSize e:text"},Math.round(n*t.y)),a.ReactBEM.createElement("div",{bem:"e:label"},this._t("pesdk.text.button.size")))))}}},{key:"_renderFontFamilyOverlayControl",value:function(){var e=this.getSharedState("selectedSprite");if(e)return a.ReactBEM.createElement(p.default,{fontFamily:e.getFontFamily(),fontWeight:e.getFontWeight(),fontStyle:e.getFontStyle(),fonts:this._fonts,onChange:this._onFontChange})}},{key:"_renderFontItem",value:function(){var e=this.getSharedState("selectedSprite");if(e){var t="font"===this.state.mode?"is-active":null;return a.ReactBEM.createElement("li",{bem:"e:item",key:"font"},a.ReactBEM.createElement("bem",{specifier:"$b:controls"},a.ReactBEM.createElement("div",{bem:"$e:button m:withLabel",className:t,"data-identifier":"font",onClick:this._switchToMode.bind(this,"font")},a.ReactBEM.createElement(f.default,{fontFamily:e.getFontFamily(),fontWeight:e.getFontWeight(),fontStyle:e.getFontStyle()}),a.ReactBEM.createElement("div",{bem:"e:label"},this._t("pesdk.text.button.font")))))}}},{key:"_renderAlignmentItem",value:function(){var e=this.getSharedState("selectedSprite");if(e){var t=e.getAlignment();return a.ReactBEM.createElement("li",{bem:"e:item",key:"alignment"},a.ReactBEM.createElement("bem",{specifier:"$b:controls"},a.ReactBEM.createElement("div",{bem:"$e:button m:withLabel",onClick:this._onAlignmentClick,"data-identifier":"alignment"},a.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("controls/text/align_"+t+".png",!0)}),a.ReactBEM.createElement("div",{bem:"e:label"},this._t("pesdk.text.button.alignment")))))}}},{key:"_renderTakeToFrontItem",value:function(){return a.ReactBEM.createElement("li",{bem:"e:item",key:"takeToFront"},a.ReactBEM.createElement("bem",{specifier:"$b:controls"},a.ReactBEM.createElement("div",{bem:"$e:button m:withLabel",onClick:this._onTakeToFrontClick},a.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("controls/sprites/take_to_front.png",!0)}),a.ReactBEM.createElement("div",{bem:"e:label"},this._t("pesdk.text.button.takeToFront")))))}},{key:"renderControls",value:function(){if(this.state.loading)return a.ReactBEM.createElement("div",null);var e=[this._renderSizeItem(),this._renderFontItem(),this._renderAlignmentItem()],t=this.getSharedState("selectedSprite"),n=t.getColor().clone(),i=t.getBackgroundColor().clone();return[a.ReactBEM.createElement("div",{bem:"e:cell m:list"},a.ReactBEM.createElement(l.default,{ref:"scrollbar"},a.ReactBEM.createElement("ul",{bem:"$e:list"},e))),a.ReactBEM.createElement("div",{bem:"e:cell m:colorPicker"},a.ReactBEM.createElement(c.default,{initialValue:n,label:this._t("pesdk.text.button.foreground"),onChange:this._onForegroundColorChange})),a.ReactBEM.createElement("div",{bem:"e:cell m:colorPicker"},a.ReactBEM.createElement(c.default,{initialValue:i,label:this._t("pesdk.text.button.background"),onChange:this._onBackgroundColorChange}))]}}]),t}();t.default=_,_.contextTypes=s.default.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0},a=n(0),s=i(n(160)),l=i(n(161)),c=i(n(162)),u=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));o._value=o.props.initialValue.clone();var a=o._value.toHSV(),s=a[0],l=a[1],c=a[2];return o._hsv={h:s,s:l,v:c},o._bindAll("_onElementClick","_onColorChange","_onDocumentClick"),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.BaseComponent),r(t,[{key:"componentDidMount",value:function(){o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this),document.addEventListener("click",this._onDocumentClick)}},{key:"componentWillUnmount",value:function(){o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentWillUnmount",this).call(this),document.removeEventListener("click",this._onDocumentClick)}},{key:"_onDocumentClick",value:function(e){for(var t=e.target;t;t=t.parentNode)if(t===this.refs.root)return;this.props.onClose&&this.props.onClose()}},{key:"_onElementClick",value:function(e){e.stopPropagation()}},{key:"_onColorChange",value:function(e){this._value=e,this.props.onChange&&this.props.onChange(e)}},{key:"renderWithBEM",value:function(){var e=void 0;return!1!==this.props.alpha&&(e=a.ReactBEM.createElement(s.default,{initialValue:this._value,onChange:this._onColorChange})),a.ReactBEM.createElement("div",{bem:"$b:colorPicker $e:overlay",onClick:this._onElementClick,ref:"root"},e,a.ReactBEM.createElement("div",{bem:"e:bottom"},a.ReactBEM.createElement(l.default,{initialValue:this._value,onChange:this._onColorChange}),a.ReactBEM.createElement(c.default,{initialValue:this._value,onChange:this._onColorChange})))}}]),t}();t.default=u,u.contextTypes=a.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(6)),a=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),o=0;o<n;o++)i[o]=arguments[o];var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return a._bindAll("_onKnobDrag","_onKnobDragStart"),a._value=a.props.initialValue.clone(),a._transparentPatternCanvas=r.Utils.createTransparentPatternCanvas(),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"componentDidMount",value:function(){(function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this),this._renderCanvas()}},{key:"shouldComponentUpdate",value:function(e){var t=e.initialValue;return t!==this._value&&(this._value=t.clone(),this._renderCanvas(),!0)}},{key:"_onKnobDragStart",value:function(e,t){t.target===this.refs.knob?this._initialAlpha=this._value.a:this._setAlphaFromPosition(e)}},{key:"_onKnobDrag",value:function(e,t){var n=this.refs.canvas.offsetWidth,i=e.x/n;this._setAlpha(this._initialAlpha+i)}},{key:"_getKnobStyle",value:function(){return{left:(100*this._value.a).toFixed(2)+"%",top:"50%"}}},{key:"_setAlpha",value:function(e){this._value.a=e,this._value.a=Math.min(1,Math.max(0,this._value.a)),this.forceUpdate(),this.props.onChange&&this.props.onChange(this._value)}},{key:"_setAlphaFromPosition",value:function(e){var t=this.refs.canvas;this._initialAlpha=e.x/t.offsetWidth,this._setAlpha(this._initialAlpha)}},{key:"_renderCanvas",value:function(){var e=this.refs.canvas,t=e.getContext("2d");e.width=e.offsetWidth,e.height=e.offsetHeight;var n=t.createPattern(this._transparentPatternCanvas,"repeat");t.fillStyle=n,t.fillRect(0,0,e.width,e.height);var i=t.createLinearGradient(0,0,e.width,e.height),r=this._value.clone();r.a=0,i.addColorStop(0,r.toRGBA()),i.addColorStop(1,this._value.toHex()),t.fillStyle=i,t.fillRect(0,0,e.width,e.height)}},{key:"renderWithBEM",value:function(){return r.ReactBEM.createElement("div",{bem:"$b:colorPicker $e:alpha"},r.ReactBEM.createElement(o.default,{onStart:this._onKnobDragStart,onDrag:this._onKnobDrag},r.ReactBEM.createElement("div",null,r.ReactBEM.createElement("canvas",{bem:"e:canvas",ref:"canvas"}),r.ReactBEM.createElement("div",{bem:"e:knob $b:knob m:transparent",ref:"knob",style:this._getKnobStyle()}))))}}]),t}();t.default=a,a.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(6)),a=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));o._bindAll("_onKnobDrag","_onKnobDragStart"),o._value=o.props.initialValue.clone();var a=o._value.toHSV(),s=a[0],l=a[1],c=a[2];return o._hsvColor={h:s,s:l,v:c},o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"componentDidMount",value:function(){(function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this),this._renderCanvas()}},{key:"shouldComponentUpdate",value:function(e){var t=e.initialValue;if(t!==this._value){this._value=t.clone();var n=this._value.toHSV(),i=n[0],r=n[1],o=n[2];return this._hsvColor={h:i,s:r,v:o},this._renderCanvas(),!0}return!1}},{key:"_onKnobDragStart",value:function(e,t){t.target===this.refs.knob?(this._initialValue=this._hsvColor.v,this._initialSaturation=this._hsvColor.s):this._setValuesFromPosition(e)}},{key:"_onKnobDrag",value:function(e,t){var n=this.refs.canvas,i=n.offsetWidth,r=n.offsetHeight,o=e.x/i,a=e.y/r*-1,s=this._hsvColor.h;this._setHSV(s,this._initialSaturation+o,this._initialValue+a)}},{key:"_getKnobStyle",value:function(){var e=this._hsvColor,t=e.s,n=e.v;return{left:(100*t).toFixed(2)+"%",top:(100*(1-n)).toFixed(2)+"%"}}},{key:"_setHSV",value:function(e,t,n){t=Math.max(.01,Math.min(t,.99)),n=Math.max(.01,Math.min(n,.99)),this._value=r.Color.fromHSV(e,t,n,this._value.a),this._hsvColor={h:e,s:t,v:n},this.forceUpdate(),this.props.onChange&&this.props.onChange(this._value)}},{key:"_setValuesFromPosition",value:function(e){var t=this.refs.canvas;this._initialSaturation=e.x/t.offsetWidth,this._initialValue=1-e.y/t.offsetHeight;var n=this._hsvColor.h;this._setHSV(n,this._initialSaturation,this._initialValue)}},{key:"_renderCanvas",value:function(){var e=this.refs.canvas,t=e.getContext("2d");e.width=e.offsetWidth,e.height=e.offsetHeight;for(var n=t.getImageData(0,0,e.width,e.height),i=0;i<e.height;i++)for(var o=(e.height-i)/e.height,a=0;a<e.width;a++){var s=a/e.width,l=r.Color.fromHSV(this._hsvColor.h,s,o),c=l.r,u=l.g,f=l.b,p=l.a,d=4*(i*e.width+a);n.data[d]=255*c,n.data[d+1]=255*u,n.data[d+2]=255*f,n.data[d+3]=255*p}t.putImageData(n,0,0)}},{key:"renderWithBEM",value:function(){return r.ReactBEM.createElement("div",{bem:"$b:colorPicker $e:saturation"},r.ReactBEM.createElement(o.default,{onStart:this._onKnobDragStart,onDrag:this._onKnobDrag},r.ReactBEM.createElement("div",null,r.ReactBEM.createElement("canvas",{bem:"e:canvas",ref:"canvas"}),r.ReactBEM.createElement("div",{bem:"e:knob $b:knob m:transparent",ref:"knob",style:this._getKnobStyle()}))))}}]),t}();t.default=a,a.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(6)),a=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));o._bindAll("_onKnobDrag","_onKnobDragStart"),o._value=o.props.initialValue.clone();var a=o._value.toHSV(),s=a[0],l=a[1],c=a[2];return o._hsvColor={h:s,s:l,v:c},o.state={value:o.props.initialValue},o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"componentDidMount",value:function(){(function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this),this._renderCanvas()}},{key:"shouldComponentUpdate",value:function(e){var t=e.initialValue;if(t!==this._value){this._value=t.clone();var n=this._value.toHSV(),i=n[0],r=n[1],o=n[2];return this._hsvColor={h:i,s:r,v:o},this._renderCanvas(),!0}return!1}},{key:"_onKnobDragStart",value:function(e,t){t.target===this.refs.knob?this._initialHue=this._hsvColor.h:this._setValueFromPosition(e)}},{key:"_onKnobDrag",value:function(e,t){var n=this.refs.canvas.offsetHeight,i=e.y/n;this._setHue(this._initialHue+i)}},{key:"_getKnobStyle",value:function(){return{left:"50%",top:(100*this._hsvColor.h).toFixed(2)+"%"}}},{key:"_setHue",value:function(e){var t=this._hsvColor,n=t.s,i=t.v;e=Math.min(1,Math.max(0,e)),n=Math.max(.01,Math.min(n,.99)),i=Math.max(.01,Math.min(i,.99)),this._value=r.Color.fromHSV(e,n,i,this._value.a),this._hsvColor={h:e,s:n,v:i},this.forceUpdate(),this.props.onChange&&this.props.onChange(this._value)}},{key:"_setValueFromPosition",value:function(e){var t=this.refs.canvas;this._initialHue=e.y/t.offsetHeight,this._setHue(this._initialHue)}},{key:"_renderCanvas",value:function(){var e=this.refs.canvas,t=e.getContext("2d");e.width=e.offsetWidth,e.height=e.offsetHeight;for(var n=0;n<e.height;n++){var i=n/e.height,o=r.Color.fromHSV(i,1,1);t.strokeStyle=o.toRGBA(),t.beginPath(),t.moveTo(0,n),t.lineTo(e.width,n),t.stroke()}}},{key:"renderWithBEM",value:function(){return r.ReactBEM.createElement("div",{bem:"$b:colorPicker $e:hue"},r.ReactBEM.createElement(o.default,{onStart:this._onKnobDragStart,onDrag:this._onKnobDrag},r.ReactBEM.createElement("div",null,r.ReactBEM.createElement("canvas",{bem:"e:canvas",ref:"canvas"}),r.ReactBEM.createElement("div",{bem:"e:knob $b:knob m:transparent",ref:"knob",style:this._getKnobStyle()}))))}}]),t}();t.default=a,a.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(2)),s=i(n(45)),l=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.BaseComponent),r(t,[{key:"_onListItemClick",value:function(e,t){this.props.onChange&&this.props.onChange(e)}},{key:"_renderListItems",value:function(){var e=this;return this.props.fonts.map(function(t){var n=e.props.selectedIdentifier;return t.getVariations().map(function(i){var r=n===i.getIdentifier()?"is-active":null;return o.ReactBEM.createElement("li",{bem:"e:item",key:i.getIdentifier(),className:r,onClick:e._onListItemClick.bind(e,i)},o.ReactBEM.createElement(s.default,{fontFamily:i.getFontFamily(),fontWeight:i.getFontWeight(),fontStyle:i.getFontStyle()}),o.ReactBEM.createElement("div",{bem:"e:label"},t.getFontFamily()))})})}},{key:"renderWithBEM",value:function(){var e=this._renderListItems();return o.ReactBEM.createElement("div",{bem:"$b:controls e:overlay m:dark m:large"},o.ReactBEM.createElement(a.default,null,o.ReactBEM.createElement("ul",{bem:"$b:fontFamily e:list"},e)))}}]),t}();t.default=l,l.contextTypes=o.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(5),r=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i.Configurable),t}();t.default=r,r.prototype.availableOptions={fontFamily:{type:i.OptionType.STRING,required:!0},variations:{type:i.OptionType.ARRAY,required:!0}}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0),a=i(n(4)),s=i(n(166)),l=i(n(168)),c=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),r(t,null,[{key:"onExit",value:function(){var e=this.context.editor;e.zoom.restore(),e.features.enable("zoom","drag"),e.render()}},{key:"onEnter",value:function(e,t){var n=this.context.editor;n.zoom.save(),n.zoom.set("auto",function(){n.render()});var i=n.getOutputDimensions(),r=n.operations.exists("sprite"),a=n.operations.getOrCreate("sprite"),s=a.createBrush(),l=a.serializeOptions(void 0,!0);a.addSprite(s);var c=Math.max(.05*i.min(),1);t.sizePresets&&t.sizePresets.length>0&&(c=t.sizePresets[0]);var u=new o.Color(1,0,0,1);this.setSharedState({operationExistedBefore:r,operation:a,brush:s,initialOptions:l,size:c,color:u,hardness:1})}},{key:"isAvailable",value:function(e){return e.isToolAllowed("brush")&&e.isToolEnabled("brush")}},{key:"getPreloadAssets",value:function(){return[]}}]),t}();c.controlsComponent=s.default,c.canvasControlsComponent=l.default,c.identifier="brush",c.iconPath="controls/overview/brush.png",c.languageKey="pesdk.brush.title.name",c.defaultOptions={sizePresets:[]},c.requiredOperations=["sprite"],t.default=c},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(0),s=i(n(3)),l=i(n(15)),c=i(n(2)),u=i(n(29)),f=i(n(167)),p=function(e){function t(){var e,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,o=Array(i),s=0;s<i;s++)o[s]=arguments[s];var l=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(o)));return l._hasDoneButton=!1,l._brushOptions={size:l.getSharedState("size"),color:l.getSharedState("color").clone()},l._hasPresets=l.props.options.sizePresets&&l.props.options.sizePresets.length>0,l._hasSlider=!l._hasPresets,l._bindAll("_onSizeUpdated","_onColorUpdated","_onOperationUpdated","_onOperationRemoved"),l.state={sizeControlsEnabled:!1},l._events=(r(n={},a.Constants.EVENTS.OPERATION_UPDATED,l._onOperationUpdated),r(n,a.Constants.EVENTS.OPERATION_REMOVED,l._onOperationRemoved),n),l}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.default),o(t,[{key:"componentDidMount",value:function(){(function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this);var e=this.context.editor;e.zoom.set("auto"),e.features.disable("zoom","drag")}},{key:"_onSizeClick",value:function(e){this._onSizeUpdated(e),this.forceUpdate()}},{key:"_onOperationRemoved",value:function(e){if(e===this.getSharedState("operation")&&!this._backButtonClicked){var t=this.context.editor,n=t.operations.getOrCreate("sprite"),i=n.createBrush();n.addSprite(i),this.setSharedState({operation:n,brush:i,operationExistedBefore:!1,initialOptions:{}}),t.render()}}},{key:"_onOperationUpdated",value:function(e){if(e===this.getSharedState("operation")){var t=this.getSharedState("brush");if(t){var n=e.getSprites().filter(function(e){return e.getId()===t.getId()})[0];this.setSharedState({brush:n})}this.context.editor.render()}}},{key:"_onSizeUpdated",value:function(e){this.setSharedState({size:e}),this._brushOptions.size=e}},{key:"_onColorUpdated",value:function(e){this.setSharedState({color:e}),this._brushOptions.color=e.clone()}},{key:"_renderSizeItems",value:function(){var e=this,t=this.props.options.sizePresets,n=Math.max.apply(null,t);return t.map(function(t){var i=e.getSharedState("size")===t;return a.ReactBEM.createElement(f.default,{size:t,maxSize:n,active:i,key:t,onClick:e._onSizeClick.bind(e,t)})})}},{key:"renderControls",value:function(){var e=this.context.editor,t=e.zoom.get(),n=[];if(this._hasSlider){var i=e.getFinalDimensions(),r=Math.round(i.clone().multiply(t).min()/2),o=this._brushOptions.size;n.push(a.ReactBEM.createElement("div",{bem:"e:cell m:slider"},a.ReactBEM.createElement(l.default,{style:"large",minValue:1,maxValue:r,valueUnit:"px",middleDot:!1,label:this._t("pesdk.brush.text.size"),onChange:this._onSizeUpdated,value:o})))}else this._hasPresets&&n.push(a.ReactBEM.createElement("div",{bem:"e:cell m:list"},a.ReactBEM.createElement(c.default,null,a.ReactBEM.createElement("ul",{bem:"$e:list"},this._renderSizeItems()))));return n.push(a.ReactBEM.createElement("div",{bem:"e:cell m:colorPicker"},a.ReactBEM.createElement(u.default,{initialValue:this._brushOptions.color.clone(),onChange:this._onColorUpdated}))),n}}]),t}();t.default=p,p.contextTypes=s.default.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"componentDidMount",value:function(){(function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this),this._renderCanvas()}},{key:"componentDidUpdate",value:function(){this._renderCanvas()}},{key:"_renderCanvas",value:function(){var e=this.refs.canvas,t=e.getContext("2d");e.width=e.offsetWidth,e.height=e.offsetHeight;var n=this.props,i=n.maxSize,r=n.size,o=e.width*(r/i)/2;t.fillStyle="white",t.beginPath(),t.arc(e.width/2,e.height/2,o,0,2*Math.PI),t.fill()}},{key:"renderWithBEM",value:function(){return r.ReactBEM.createElement("bem",{specifier:"$b:controls $e:list"},r.ReactBEM.createElement("li",{bem:"e:item",onClick:this.props.onClick},r.ReactBEM.createElement("bem",{specifier:"$b:controls"},r.ReactBEM.createElement("div",{bem:"$e:button m:withLabel",className:this.props.active?"is-active":null},r.ReactBEM.createElement("canvas",{bem:"e:canvas",ref:"canvas"}),r.ReactBEM.createElement("div",{bem:"e:label"},this.props.size)))))}}]),t}();t.default=o,o.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0},o=n(0),a=function(e){return e&&e.__esModule?e:{default:e}}(n(16)),s=o.SDK.Operations.SpriteOperation.BrushSprite,l=o.SDK.Operations.SpriteOperation.BrushSprite.Brushes.RadialBrush,c=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return a._windowResized=!1,a._drawing=!1,a._bindAll("_onMouseEnter","_onMouseLeave","_onMouseDown","_onMouseMove","_onMouseUp","_onMouseMoveOnCanvas","_onWindowResize"),a._lastDrawPosition=null,a._events=o.SDKUtils.extend(a._events,function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},o.Constants.EVENTS.WINDOW_RESIZE,a._onWindowResize)),a.state={cursorVisible:!1,cursorPosition:new o.Vector2},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),i(t,[{key:"componentDidMount",value:function(){r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this),this._updateContainerRect()}},{key:"componentDidUpdate",value:function(){this._windowResized&&(this._updateContainerRect(),this._windowResized=!1)}},{key:"_onWindowResize",value:function(){this._windowResized=!0}},{key:"_onOperationRemoved",value:function(e){}},{key:"_onOperationUpdated",value:function(e){e===this.getSharedState("operation")&&this.forceUpdate()}},{key:"_onMouseDown",value:function(e){e.preventDefault(),this._optionsBeforeDraw=this.getSharedState("operation").serializeOptions(),this._operationExistedBeforeDraw=this.getSharedState("operationExistedBefore"),this.setSharedState({operationExistedBefore:!0},!1);var t=this.context.editor.getOutputDimensions(),n=this._getCursorPosition(e),i=this.getSharedState("brush"),r=this.getSharedState("size")/t.min(),o=this.getSharedState("color"),a=this.getSharedState("hardness");this._drawing=!0;var s=new l({size:r,hardness:a,color:o});this._currentPath=i.createPath(s),this._currentPath.addControlPoint(n.clone().divide(t)),document.addEventListener("mousemove",this._onMouseMove),document.addEventListener("touchmove",this._onMouseMove),document.addEventListener("mouseup",this._onMouseUp),document.addEventListener("touchend",this._onMouseUp)}},{key:"_onMouseUp",value:function(){this._currentPath.setClosed(!0);var e=this.context.editor,t=e.getOutputTextureDimensions();this.getSharedState("brush").render(t),this._currentPath=null,this._drawing=!1,e.history.add(this.getSharedState("operation"),this._optionsBeforeDraw,this._operationExistedBeforeDraw),document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("touchmove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),document.removeEventListener("touchend",this._onMouseUp)}},{key:"_onMouseEnter",value:function(e){var t=this._getCursorPosition(e);this.setState({cursorVisible:!0,cursorPosition:t}),this._onMouseMove(e)}},{key:"_onMouseLeave",value:function(){this.setState({cursorVisible:!1})}},{key:"_onMouseMove",value:function(e){var t=this.context.editor,n=t.getOutputDimensions(),i=t.getOutputTextureDimensions(),r=t.zoom.get(),o=this._getCursorPosition(e);this.setState({cursorPosition:o});var a=void 0;if(this._lastDrawPosition){var s=this.getSharedState("size");a=this._lastDrawPosition.clone().subtract(o).abs().len()/r>=s/10}else a=!0;this._drawing&&a&&(this._currentPath.addControlPoint(o.clone().divide(n)),this.getSharedState("brush").render(i),this._lastDrawPosition=o.clone())}},{key:"_onMouseMoveOnCanvas",value:function(e){var t=this._getCursorPosition(e);this.setState({cursorPosition:t})}},{key:"_getPropsForSprite",value:function(e){var n=r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_getPropsForSprite",this).call(this,e);return e instanceof s&&(n.hideContent=!1),n}},{key:"_getCursorStyle",value:function(){var e=this.getSharedState("size"),t=this.getSharedState("color"),n=this.state.cursorPosition;return{left:n.x,top:n.y,width:e,height:e,background:t.toRGBA(),marginLeft:-.5*e,marginTop:-.5*e}}},{key:"_updateContainerRect",value:function(){this._containerBoundingRect=this.refs.innerContainer.getBoundingClientRect()}},{key:"_getCursorPosition",value:function(e){var t=o.Utils.getEventPosition(e),n=this._containerBoundingRect;return t.subtract(n.left,n.top)}},{key:"_getContainerProps",value:function(){var e=r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_getContainerProps",this).call(this);return e.onMouseDown=e.onTouchStart=this._onMouseDown,e}},{key:"_getInnerContainerProps",value:function(){var e=r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_getInnerContainerProps",this).call(this);return delete e.onClick,e.onMouseEnter=this._onMouseEnter,e.onMouseLeave=this._onMouseLeave,e.onMouseMove=this._onMouseMoveOnCanvas,e}},{key:"_renderOverlayControls",value:function(){var e=this.state.cursorVisible?"is-visible":null;return o.ReactBEM.createElement("div",{bem:"$b:brushCanvasControls"},o.ReactBEM.createElement("div",{bem:"e:cursor",className:e,style:this._getCursorStyle()}))}}]),t}();t.default=c,c.contextTypes=a.default.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=i(n(4)),a=i(n(170)),s=i(n(171)),l=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),r(t,null,[{key:"onExit",value:function(){var e=this.context.editor,t=this.getSharedState("operation");0===t.getPaths().length&&e.operations.remove(t),e.zoom.restore(),e.features.enable("zoom","drag"),e.render()}},{key:"onEnter",value:function(e,t){var n=this.context.editor;n.zoom.save(),n.zoom.set("auto",function(){n.render()});var i=n.getOutputDimensions(),r=n.operations.exists("selective-blur"),o=n.operations.getOrCreate("selective-blur"),a=o.serializeOptions(),s=o.getBrush(),l=.1*i.min(),c=o.getInputDimensions();this.setSharedState({operationExistedBefore:r,operation:o,brush:s,initialOptions:a,size:l,hardness:1,inputDimensions:c})}},{key:"isAvailable",value:function(e){return e.isToolEnabled("selective-blur")}}]),t}();l.controlsComponent=a.default,l.canvasControlsComponent=s.default,l.identifier="selective-blur",l.iconPath="controls/overview/selective-blur.png",l.languageKey="controls.overview.selective-blur",l.defaultOptions={},l.requiredOperations=["selective-blur"],t.default=l},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(0),s=i(n(3)),l=i(n(15)),c=i(n(7)),u=function(e){function t(){var e,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,o=Array(i),s=0;s<i;s++)o[s]=arguments[s];var l=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(o)));return l._hasDoneButton=!1,l._brushSize=l.getSharedState("size"),l._bindAll("_onOperationUpdated","_onOperationRemoved","_onSizeUpdated","_onBlurRadiusChange"),l.state={sizeControlsEnabled:!1},l._events=(r(n={},a.Constants.EVENTS.OPERATION_UPDATED,l._onOperationUpdated),r(n,a.Constants.EVENTS.OPERATION_REMOVED,l._onOperationRemoved),n),l}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.default),o(t,[{key:"componentDidMount",value:function(){(function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this);var e=this.context.editor;e.zoom.set("auto"),e.features.disable("zoom","drag")}},{key:"_onOperationRemoved",value:function(e){if(e===this.getSharedState("operation")&&!this._backButtonClicked){var t=this.context.editor,n=t.operations.getOrCreate("selective-blur"),i=n.getBrush();this.setSharedState({operation:n,brush:i,operationExistedBefore:!1,initialOptions:{}}),t.render()}}},{key:"_onOperationUpdated",value:function(e){e===this.getSharedState("operation")&&(this.context.editor.render(),this.forceUpdate())}},{key:"_onSizeUpdated",value:function(e){this.setSharedState({size:e}),this._brushSize=e}},{key:"_onBlurRadiusChange",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=this.getSharedState("inputDimensions");this.getSharedState("operation").setBlurRadius(e/i.min());var r=this.context.editor;r.render(),n&&r.history.add(this.getSharedState("operation"),{blurRadius:t/i.min()},!0)}},{key:"renderOverlayControls",value:function(){var e=this.getSharedState("inputDimensions").min(),t=this.getSharedState("operation").getBlurRadius()*e;return a.ReactBEM.createElement(c.default,{minValue:0,maxValue:Math.min(180,Math.round(.1*e)),value:t,valueUnit:"px",label:this._t("controls.selectiveBlur.blurRadius"),onChange:this._onBlurRadiusChange})}},{key:"renderControls",value:function(){var e=this.context.editor,t=e.zoom.get(),n=[],i=e.getFinalDimensions(),r=Math.round(i.clone().multiply(t).min()/2),o=this._brushSize;return n.push(a.ReactBEM.createElement("div",{bem:"e:cell m:slider"},a.ReactBEM.createElement(l.default,{style:"large",minValue:1,maxValue:r,valueUnit:"px",middleDot:!1,label:this._t("controls.brush.size"),onChange:this._onSizeUpdated,value:o}))),n}}]),t}();t.default=u,u.contextTypes=s.default.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0},o=n(0),a=function(e){return e&&e.__esModule?e:{default:e}}(n(16)),s=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return a._windowResized=!1,a._drawing=!1,a._bindAll("_onMouseEnter","_onMouseLeave","_onMouseDown","_onMouseMove","_onMouseUp","_onMouseMoveOnCanvas","_onWindowResize"),a._lastDrawPosition=null,a._events=o.SDKUtils.extend(a._events,function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},o.Constants.EVENTS.WINDOW_RESIZE,a._onWindowResize)),a.state={cursorVisible:!1,cursorPosition:new o.Vector2},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default),i(t,[{key:"componentDidMount",value:function(){r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this),this._updateContainerRect()}},{key:"componentDidUpdate",value:function(){this._windowResized&&(this._updateContainerRect(),this._windowResized=!1)}},{key:"_onWindowResize",value:function(){this._windowResized=!0}},{key:"_onOperationRemoved",value:function(e){}},{key:"_onOperationUpdated",value:function(e){e===this.getSharedState("operation")&&this.forceUpdate()}},{key:"_onMouseDown",value:function(e){e.preventDefault();var t=this.getSharedState("operation");this._optionsBeforeDraw=t.serializeOptions(),this._operationExistedBeforeDraw=this.getSharedState("operationExistedBefore"),this.setSharedState({operationExistedBefore:!0},!1);var n=this.context.editor.getOutputDimensions(),i=this._getCursorPosition(e),r=this.getSharedState("size")/n.min(),o=this.getSharedState("hardness");this._drawing=!0,this._currentPath=t.createPath(r,o),this._currentPath.addControlPoint(i.clone().divide(n)),document.addEventListener("mousemove",this._onMouseMove),document.addEventListener("touchmove",this._onMouseMove),document.addEventListener("mouseup",this._onMouseUp),document.addEventListener("touchend",this._onMouseUp)}},{key:"_onMouseUp",value:function(){this._currentPath.setClosed(!0);var e=this.context.editor;e.render(),this._currentPath=null,this._drawing=!1,e.history.add(this.getSharedState("operation"),this._optionsBeforeDraw,this._operationExistedBeforeDraw),document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("touchmove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),document.removeEventListener("touchend",this._onMouseUp)}},{key:"_onMouseEnter",value:function(e){var t=this._getCursorPosition(e);this.setState({cursorVisible:!0,cursorPosition:t}),this._onMouseMove(e)}},{key:"_onMouseLeave",value:function(){this.setState({cursorVisible:!1})}},{key:"_onMouseMove",value:function(e){var t=this.context.editor,n=t.getOutputDimensions(),i=t.zoom.get(),r=this._getCursorPosition(e);this.setState({cursorPosition:r});var o=void 0;if(this._lastDrawPosition){var a=this.getSharedState("size");o=this._lastDrawPosition.clone().subtract(r).abs().len()/i>=a/10}else o=!0;this._drawing&&o&&(this._currentPath.addControlPoint(r.clone().divide(n)),this._lastDrawPosition=r.clone(),t.render())}},{key:"_onMouseMoveOnCanvas",value:function(e){var t=this._getCursorPosition(e);this.setState({cursorPosition:t})}},{key:"_getCursorStyle",value:function(){var e=this.getSharedState("size"),t=this.state.cursorPosition;return{left:t.x,top:t.y,width:e,height:e,marginLeft:-.5*e,marginTop:-.5*e}}},{key:"_updateContainerRect",value:function(){this._containerBoundingRect=this.refs.innerContainer.getBoundingClientRect()}},{key:"_getCursorPosition",value:function(e){var t=o.Utils.getEventPosition(e),n=this._containerBoundingRect;return t.subtract(n.left,n.top)}},{key:"_getContainerProps",value:function(){var e=r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_getContainerProps",this).call(this);return e.onMouseDown=e.onTouchStart=this._onMouseDown,e}},{key:"_getInnerContainerProps",value:function(){var e=r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_getInnerContainerProps",this).call(this);return delete e.onClick,e.onMouseEnter=this._onMouseEnter,e.onMouseLeave=this._onMouseLeave,e.onMouseMove=this._onMouseMoveOnCanvas,e}},{key:"_renderSpriteItems",value:function(){return null}},{key:"_renderOverlayControls",value:function(){var e=this.state.cursorVisible?"is-visible":null;return o.ReactBEM.createElement("div",{bem:"$b:selectiveBlurCanvasControls"},o.ReactBEM.createElement("div",{bem:"e:cursor",className:e,style:this._getCursorStyle()}))}}]),t}();t.default=s,s.contextTypes=a.default.contextTypes},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=i(n(4)),a=i(n(173)),s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),r(t,null,[{key:"onExit",value:function(){var e=this.context.editor,t=this.getSharedState("operation"),n=this.getSharedState("initialOptions"),i=t.getFrame(),r=t.getScale();(i&&i.identifier)===(n.frame&&n.frame.identifier)&&r===n.scale||e.history.add(t,this.getSharedState("initialOptions"),this.getSharedState("operationExistedBefore")),t.getFrame()||e.operations.remove(t),e.render()}},{key:"onEnter",value:function(e){var t=this.context.editor,n=t.operations.exists("frame"),i=t.operations.getOrCreate("frame"),r=i.serializeOptions();this.setSharedState({operation:i,operationExistedBefore:n,initialOptions:r,inputDimensions:i.getInputDimensions(),frame:i.getFrame()})}},{key:"isAvailable",value:function(e){return e.isToolAllowed("frame")&&e.isToolEnabled("frame")}}]),t}();s.controlsComponent=a.default,s.identifier="frame",s.iconPath="controls/overview/frame.png",s.languageKey="pesdk.frame.title.name",s.defaultOptions={frames:[]},s.requiredOperations=["sprite"],s.getPreloadAssets=o.default.getPreloadAssets,t.default=s},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(0),s=i(n(3)),l=i(n(2)),c=i(n(1)),u=i(n(47)),f=i(n(174)),p=i(n(29)),d=i(n(7)),h=i(n(48)),_=function(e){function t(){var e,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,o=Array(i),s=0;s<i;s++)o[s]=arguments[s];var l=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(o)));return l._operation=l.getSharedState("operation"),l._bindAll("_onScaleChange","_onColorChange","_onOperationUpdated","_onOperationRemoved"),l._events=(r(n={},a.Constants.EVENTS.OPERATION_UPDATED,l._onOperationUpdated),r(n,a.Constants.EVENTS.OPERATION_REMOVED,l._onOperationRemoved),n),l._initFrameManager(),l}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.default),o(t,[{key:"_initFrameManager",value:function(){this._frameManager=new u.default(this.context.ui,this.props.options)}},{key:"_onOperationUpdated",value:function(e){e===this.getSharedState("operation")&&this.forceSharedUpdate()}},{key:"_onOperationRemoved",value:function(e){if(e===this.getSharedState("operation")&&!this._backButtonClicked){var t=this.context.editor,n=t.operations.getOrCreate("frame");this.setSharedState({operation:n,frame:null,operationExistedBefore:!1,initialOptions:{}}),t.render()}}},{key:"_onScaleChange",value:function(e){var t=this.context.editor,n=this.getSharedState("inputDimensions");this._operation.setScale(e/n.min()),t.render()}},{key:"_onColorChange",value:function(e){this.getSharedState("operation").setTintColor(e.clone()),this.context.editor.render()}},{key:"_onBackClick",value:function(e){this._backButtonClicked=!0,this.props.onSwitchControls("home"),e.preventDefault()}},{key:"_onFrameClick",value:function(e){var t=this,n=this.context.editor,i=this.getSharedState("operation");if(null===e)return i.setFrame(null),n.render(),this.setSharedState({frame:null});var r=void 0,o=setTimeout(function(){r=c.default.instance.displayLoading(t._t("pesdk.common.text.loading"))},100),a=new h.default(this.context.ui,e);a.load().then(function(){r&&r.close(),o&&(clearTimeout(o),o=null);var e=a.getFrame();i.setFrame(e),t.context.editor.render(),t.setSharedState({frame:a})})}},{key:"renderOverlayControls",value:function(){if(!this.getSharedState("frame"))return null;var e=this.getSharedState("inputDimensions"),t=Math.round(.3*e.min()),n=this._operation.getScale()*e.min();return a.ReactBEM.createElement(d.default,{minValue:5,maxValue:t,value:n,valueUnit:"px",middleDot:!1,label:this._t("pesdk.frame.text.scale"),onChange:this._onScaleChange})}},{key:"_renderListItems",value:function(){var e=this,t=this._frameManager.getFramesForCategory("all"),n=this.getSharedState("operation").getFrame();return[a.ReactBEM.createElement("li",{bem:"e:item",key:"no-frame",onClick:this._onFrameClick.bind(this,null)},a.ReactBEM.createElement("bem",{specifier:"$b:controls"},a.ReactBEM.createElement("div",{bem:"$e:button m:withLabel",className:n?null:"is-active"},a.ReactBEM.createElement("img",{bem:"e:icon",src:this._getAssetPath("controls/frame/no-frame.png",!0)}),a.ReactBEM.createElement("div",{bem:"e:label"},this._t("pesdk.frame.button.none")))))].concat(t.map(function(t,i){return a.ReactBEM.createElement(f.default,{frame:t,active:n&&n.identifier===t.identifier,onClick:e._onFrameClick.bind(e,t)})}))}},{key:"renderControls",value:function(){var e=this.getSharedState("operation").getFrame(),t=this._renderListItems(),n=[a.ReactBEM.createElement("div",{bem:"e:cell m:list"},a.ReactBEM.createElement(l.default,{ref:"scrollbar"},a.ReactBEM.createElement("ul",{bem:"$e:list"},t)))];if(e&&e.tintable){var i=this.getSharedState("operation");n.push(a.ReactBEM.createElement("div",{bem:"e:cell m:colorPicker"},a.ReactBEM.createElement(p.default,{initialValue:i.getTintColor().clone(),onChange:this._onColorChange})))}return n}}]),t}();t.default=_,_.contextTypes=s.default.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o.state={frame:o.props.frame},o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"componentDidMount",value:function(){this._renderFrame()}},{key:"componentWillReceiveProps",value:function(e){var t=this;this.props.frame!==e.frame&&this.setState({frame:e.frame},function(){t._renderFrame()})}},{key:"_renderFrame",value:function(){var e=this.context.editor.getSDK(),t=this.props.frame,n=this._getAssetPath(t.thumbnail),i=this.refs["canvas-"+t.identifier],o=e.getPixelRatio();i.width=i.offsetWidth*o,i.height=i.offsetHeight*o,i.style.width=i.offsetWidth+"px",i.style.height=i.offsetHeight+"px";var a=i.getContext("2d"),s=new window.Image;s.addEventListener("load",function(){var e=Math.min(i.width/s.width,i.height/s.height),t=new r.Vector2(s.width,s.height).multiply(e),n=new r.Vector2(i.width,i.height).divide(2).subtract(t.clone().divide(2));a.drawImage(s,0,0,s.width,s.height,n.x,n.y,t.x,t.y)}),s.crossOrigin=this.context.editor.getCrossOrigin(),s.src=n}},{key:"renderWithBEM",value:function(){return r.ReactBEM.createElement("bem",{specifier:"b:controls e:list"},r.ReactBEM.createElement("li",{bem:"e:item",key:this.props.frame.identifier,onClick:this.props.onClick},r.ReactBEM.createElement("bem",{specifier:"$b:controls"},r.ReactBEM.createElement("div",{bem:"$e:button m:withInlineLabel"},r.ReactBEM.createElement("canvas",{bem:"e:canvas m:large",ref:"canvas-"+this.props.frame.identifier}),r.ReactBEM.createElement("div",{bem:"$e:inlineLabel",className:this.props.active?"is-active":null},r.ReactBEM.createElement("div",{bem:"e:label"},this._t("pesdk.frame.asset."+this.props.frame.identifier)||this.props.frame.defaultName))))))}}]),t}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(){function e(t,n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._editor=t,this._sdk=n,this._mediator=i,this._options=this._editor.getOptions(),this._features={drag:this._options.editor.enableDrag,zoom:this._options.editor.enableZoom}}return i(e,[{key:"isEnabled",value:function(e){var t=e.charAt(0).toUpperCase()+e.slice(1),n=this._options.editor["enable"+t];return this._features[e]&&n}},{key:"enable",value:function(){for(var e=this,t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];n.forEach(function(t){e._features[t]=!0}),this._mediator.emit(r.Constants.EVENTS.FEATURES_ENABLED,n),this._mediator.emit(r.Constants.EVENTS.FEATURES_UPDATED,n)}},{key:"disable",value:function(){for(var e=this,t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];n.forEach(function(t){e._features[t]=!1}),this._mediator.emit(r.Constants.EVENTS.FEATURES_DISABLED,n),this._mediator.emit(r.Constants.EVENTS.FEATURES_UPDATED,n)}}]),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(e,n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return r._editor=e,r._sdk=n,r._mediator=i,r._isDefaultZoom=!1,r._zoom=r._sdk.getZoom(),r._options=r._editor.getOptions(),r._zoomLevels=[1,2,3,4,5,6.25,8.33,12.5,16.66,25,33.33,50,66.66,100,200,300,400,500,600,700,800,1200,1600,3200].map(function(e){return e/100}),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.EventEmitter),i(t,[{key:"in",value:function(){var e=this._getClosestZoomLevel(this._zoom+.001,1);if(!e)return this._zoomLevels[this._zoomLevels.length-1];this.set(e)}},{key:"out",value:function(){var e=this._getClosestZoomLevel(this._zoom-.001,-1);if(!e)return this._zoomLevels[0];this.set(e)}},{key:"_getClosestZoomLevel",value:function(e,t){return-1===t?this._zoomLevels.filter(function(t){return t<e}).pop():1===t?this._zoomLevels.filter(function(t){return t>e})[0]:void 0}},{key:"restore",value:function(){this._previousZoom&&(this.set(this._previousZoom),this._previousZoom=null)}},{key:"save",value:function(){this._previousZoom=this._zoom}},{key:"set",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this._editor.isReady()){var i=e,r=this.getDefault();"auto"===e||i===r?(i=r,e="auto",this._isDefaultZoom=!0):this._isDefaultZoom=!1;var o=Math.max(1,2*r),a=n?this.getMinimum():0;i=Math.max(a,Math.min(o,i)),this._zoom=i,this._sdk.setZoom(this._zoom),this._sdk.setTextureQuality(Math.min(this._zoom,1)),this.emit("set",this._zoom,t)}}},{key:"getDefault",value:function(){var e=this._editor.getFinalDimensions(!1),t=this._editor.getCanvasDimensions();return r.SDKUtils.resizeVectorToFit(e,t).divide(e).x}},{key:"getMinimum",value:function(){var e=this._editor.getFinalDimensions();return r.SDKUtils.resizeVectorToFit(e,new r.Vector2(300,300)).divide(e).x}},{key:"isDefault",value:function(){return this._isDefaultZoom}},{key:"get",value:function(){return this._zoom}}]),t}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(e,n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return r._editor=e,r._sdk=n,r._mediator=i,r._history=[],r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.EventEmitter),i(t,[{key:"isAvailable",value:function(){return 0!==this._history.length}},{key:"add",value:function(e,t,n){var i=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=void 0;if(e instanceof Array){var s=e;this._history.push(s),s.forEach(function(e){i._mediator.emit(r.Constants.EVENTS.HISTORY_UPDATED,e.operation)}),a=s}else a={operation:e,options:t,existent:n,undo:o},this._history.push(a),this._mediator.emit(r.Constants.EVENTS.HISTORY_UPDATED,e);return a}},{key:"undo",value:function(){var e=this,t=this._editor.operations,n=this._history.pop();n&&([].concat(n).forEach(function(n){var i=n.operation,o=n.existent,a=n.options,s=n.undo;e._mediator.emit(r.Constants.EVENTS.HISTORY_BEFORE_UNDO,n),o?((i=t.getOrCreate(i.constructor.identifier)).set(a),e._mediator.emit(r.Constants.EVENTS.OPERATION_UPDATED,i)):t.remove(i),"function"==typeof s&&s(i,a),e._mediator.emit(r.Constants.EVENTS.HISTORY_UPDATED,i),e._mediator.emit(r.Constants.EVENTS.HISTORY_UNDO,i)}),this.emit("undo"))}},{key:"reset",value:function(){this._history=[]}}]),t}();t.default=o},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=i(n(49)),a=i(n(50)),s=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._editor=t}return r(e,[{key:"serialize",value:function(){var e=new o.default(this._editor);return e.serialize.apply(e,arguments)}},{key:"deserialize",value:function(e){return new a.default(this._editor,e).deserialize()}}]),e}();t.default=s,s.version="1.0.0"},function(e,t,n){e.exports=n(180)},function(e,t,n){var i=function(){return this}()||Function("return this")(),r=i.regeneratorRuntime&&Object.getOwnPropertyNames(i).indexOf("regeneratorRuntime")>=0,o=r&&i.regeneratorRuntime;if(i.regeneratorRuntime=void 0,e.exports=n(181),r)i.regeneratorRuntime=o;else try{delete i.regeneratorRuntime}catch(e){i.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,o){var a=t&&t.prototype instanceof r?t:r,s=Object.create(a.prototype),l=new p(o||[]);return s._invoke=function(e,t,n){var r=E;return function(o,a){if(r===P)throw new Error("Generator is already running");if(r===C){if("throw"===o)throw a;return h()}for(n.method=o,n.arg=a;;){var s=n.delegate;if(s){var l=c(s,n);if(l){if(l===x)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===E)throw r=C,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=P;var u=i(e,t,n);if("normal"===u.type){if(r=n.done?C:S,u.arg===x)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=C,n.method="throw",n.arg=u.arg)}}}(e,n,l),s}function i(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function r(){}function o(){}function a(){}function s(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function l(e){var t;this._invoke=function(n,r){function o(){return new Promise(function(t,o){!function t(n,r,o,a){var s=i(e[n],e,r);if("throw"!==s.type){var l=s.arg,c=l.value;return c&&"object"==typeof c&&y.call(c,"__await")?Promise.resolve(c.__await).then(function(e){t("next",e,o,a)},function(e){t("throw",e,o,a)}):Promise.resolve(c).then(function(e){l.value=e,o(l)},a)}a(s.arg)}(n,r,t,o)})}return t=t?t.then(o,o):o()}}function c(e,t){var n=e.iterator[t.method];if(n===_){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=_,c(e,t),"throw"===t.method))return x;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return x}var r=i(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,x;var o=r.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=_),t.delegate=null,x):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,x)}function u(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function f(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function p(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(u,this),this.reset(!0)}function d(e){if(e){var t=e[v];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(y.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=_,t.done=!0,t};return i.next=i}}return{next:h}}function h(){return{value:_,done:!0}}var _,m=Object.prototype,y=m.hasOwnProperty,g="function"==typeof Symbol?Symbol:{},v=g.iterator||"@@iterator",b=g.asyncIterator||"@@asyncIterator",k=g.toStringTag||"@@toStringTag",w="object"==typeof e,O=t.regeneratorRuntime;if(O)w&&(e.exports=O);else{(O=t.regeneratorRuntime=w?e.exports:{}).wrap=n;var E="suspendedStart",S="suspendedYield",P="executing",C="completed",x={},j={};j[v]=function(){return this};var M=Object.getPrototypeOf,R=M&&M(M(d([])));R&&R!==m&&y.call(R,v)&&(j=R);var T=a.prototype=r.prototype=Object.create(j);o.prototype=T.constructor=a,a.constructor=o,a[k]=o.displayName="GeneratorFunction",O.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===o||"GeneratorFunction"===(t.displayName||t.name))},O.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,a):(e.__proto__=a,k in e||(e[k]="GeneratorFunction")),e.prototype=Object.create(T),e},O.awrap=function(e){return{__await:e}},s(l.prototype),l.prototype[b]=function(){return this},O.AsyncIterator=l,O.async=function(e,t,i,r){var o=new l(n(e,t,i,r));return O.isGeneratorFunction(t)?o:o.next().then(function(e){return e.done?e.value:o.next()})},s(T),T[k]="Generator",T[v]=function(){return this},T.toString=function(){return"[object Generator]"},O.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var i=t.pop();if(i in e)return n.value=i,n.done=!1,n}return n.done=!0,n}},O.values=d,p.prototype={constructor:p,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=_,this.done=!1,this.delegate=null,this.method="next",this.arg=_,this.tryEntries.forEach(f),!e)for(var t in this)"t"===t.charAt(0)&&y.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=_)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){function t(t,i){return o.type="throw",o.arg=e,n.next=t,i&&(n.method="next",n.arg=_),!!i}if(this.done)throw e;for(var n=this,i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i],o=r.completion;if("root"===r.tryLoc)return t("end");if(r.tryLoc<=this.prev){var a=y.call(r,"catchLoc"),s=y.call(r,"finallyLoc");if(a&&s){if(this.prev<r.catchLoc)return t(r.catchLoc,!0);if(this.prev<r.finallyLoc)return t(r.finallyLoc)}else if(a){if(this.prev<r.catchLoc)return t(r.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return t(r.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&y.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var r=i;break}}r&&("break"===e||"continue"===e)&&r.tryLoc<=t&&t<=r.finallyLoc&&(r=null);var o=r?r.completion:{};return o.type=e,o.arg=t,r?(this.method="next",this.next=r.finallyLoc,x):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),x},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),f(n),x}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var r=i.arg;f(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:d(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=_),x}}}}(function(){return this}()||Function("return this")())},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._ui=t,this._options=n,this._brushes=[],this._brushesById={},this._addBrushes(r.Constants.DEFAULTS.BRUSHES);var i=this._options,o=i.brushes,a=i.replaceBrushes,s=i.availableBrushes;this._options.brushes&&this._addBrushes(o,a),s&&(this._brushes=this._brushes.filter(function(e){return-1!==s.indexOf(e.identifier)}))}return i(e,[{key:"_addBrushes",value:function(e,t){var n=this;t&&(this._brushes=[],this._brushesById={}),e.forEach(function(e){n._brushes.push(e),n._brushesById[e.identifier]=e})}},{key:"getBrushByIdentifier",value:function(e){return this._brushesById[e]}},{key:"getBrushes",value:function(){return this._brushes}},{key:"getFirstBrush",value:function(){return this._brushes[0]}}]),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(e){return e&&e.__esModule?e:{default:e}}(n(51)),o={italic:"i"},a=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.default),i(t,[{key:"load",value:function(){return this._fonts.length&&this._addStylesheetTag(),function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"load",this).call(this)}},{key:"_addStylesheetTag",value:function(){var e=this._getFamiliesString(),t=document.createElement("link");t.rel="stylesheet",t.href="https://fonts.googleapis.com/css?family="+e,document.getElementsByTagName("head")[0].appendChild(t)}},{key:"_getFamiliesString",value:function(){var e={};this._fonts.forEach(function(t){var n=t.getFontFamily(),i=t.getFontStyle(),r=t.getFontWeight();e[n]=e[n]||[],void 0!==r?e[n].push(""+r+(o[i]||"")):e[n].push(400)});var t=[];for(var n in e){var i=e[n],r=i.length?":"+i.join(","):"",a=n.replace(" ","+")+r;t.push(a)}return t.join("|")}}]),t}();t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(e){return e&&e.__esModule?e:{default:e}}(n(185)),o="undefined"!=typeof window&&window.performance&&window.performance.now?window.performance.now.bind(window.performance):n(37),a=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._fontVariation=t,this._defaultFontRuler=new r.default,this._customFontRuler=new r.default(this._fontVariation)}return i(e,[{key:"observe",value:function(){var e=this,t=o();return new Promise(function(n,i){var r=window.setInterval(function(){if(e._defaultFontRuler.getWidth()!==e._customFontRuler.getWidth())return window.clearInterval(r),n();if(o()-t>=5e3){var a=new Error("Failed to load font "+e._fontVariation.getFontFamily()+".");return a.font=e._fontVariation,i(a)}},50)})}},{key:"dispose",value:function(){this._defaultFontRuler.dispose(),this._customFontRuler.dispose()}}]),e}();t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(e){return e&&e.__esModule?e:{default:e}}(n(46)),o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._fontVariation=t||new r.default({fontFamily:"Times New Roman",fontWeight:"normal",fontStyle:"normal"}),this._createRuler()}return i(e,[{key:"_createRuler",value:function(){this._ruler=document.createElement("div"),this._ruler.innerText="abcdefghijklmnopqrstuvwxzy",document.body.appendChild(this._ruler),this._setRulerStyle()}},{key:"_setRulerStyle",value:function(){this._ruler.style.cssText="\n      position: absolute;\n      top: -9999px;\n      left: -9999px;\n      opacity: 0;\n      display: inline-block;\n      font: "+this._fontVariation.getFontStyle()+" "+this._fontVariation.getFontWeight()+" 30px "+this._fontVariation.getFontFamily()+";\n    "}},{key:"setFontVariation",value:function(e){this._fontVariation=e,this._setRulerStyle()}},{key:"getWidth",value:function(){return this._ruler.offsetWidth}},{key:"dispose",value:function(){this._ruler&&(this._ruler.parentNode.removeChild(this._ruler),this._ruler=null)}}]),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(e){return e&&e.__esModule?e:{default:e}}(n(51)),o=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.default),i(t,[{key:"load",value:function(){var e=this,n=[];this._fonts.forEach(function(t){var i=e._ui.getAssetPath(t.getFilePath(),!1,!0);n.push('@font-face {\n        font-family: "'+t.getFontFamily()+"\";\n        src: url('"+i+"') format('woff');\n        font-weight: "+t.getFontWeight()+";\n        font-style: "+t.getFontStyle()+";\n      }")});var i=n.join("\n"),r=document.createElement("style");return r.innerHTML=i,document.getElementsByTagName("head")[0].appendChild(r),function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"load",this).call(this)}}]),t}();t.default=o},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=i(n(52)),a=i(n(53)),s=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._editor=t}return r(e,[{key:"serialize",value:function(){var e=new o.default(this._editor);return e.serialize.apply(e,arguments)}},{key:"deserialize",value:function(e){return new a.default(this._editor,e).deserialize()}}]),e}();t.default=s,s.version="1.0.1"},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=i(n(31)),a=i(n(32)),s=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._editor=t}return r(e,[{key:"serialize",value:function(){var e=new o.default(this._editor);return e.serialize.apply(e,arguments)}},{key:"deserialize",value:function(e){return new a.default(this._editor,e).deserialize()}}]),e}();t.default=s,s.version="2.0.0"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(){function e(t,n){var i=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._ui=t,this._options=n,this._overlays=r.SharedConstants.DEFAULTS.OVERLAYS.slice(0),this._overlaysByIdentifier={},n.overlays&&(n.replaceOverlays?this._overlays=n.overlays:this._overlays=this._overlays.concat(n.overlays)),n.availableOverlays&&(this._overlays=this._overlays.filter(function(e){return-1!==n.availableOverlays.indexOf(e.identifier)})),this._overlays.forEach(function(e){i._overlaysByIdentifier[e.identifier]=e})}return i(e,[{key:"getOverlays",value:function(){return this._overlays}},{key:"getOverlayByIdentifier",value:function(e){return this._overlaysByIdentifier[e]}}]),e}();t.default=o},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=i(n(191)),a=i(n(192)),s=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._editor=t}return r(e,[{key:"serialize",value:function(){var e=new o.default(this._editor);return e.serialize.apply(e,arguments)}},{key:"deserialize",value:function(e){return new a.default(this._editor,e).deserialize()}}]),e}();t.default=s,s.version="2.0.1"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){return e&&e.__esModule?e:{default:e}}(n(31)),r=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i.default),t}();t.default=r,r.version="2.0.0"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){return e&&e.__esModule?e:{default:e}}(n(32)),r=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i.default),t}();t.default=r,r.version="2.0.1"},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=i(n(54)),a=i(n(55)),s=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._editor=t}return r(e,[{key:"serialize",value:function(){var e=new o.default(this._editor);return e.serialize.apply(e,arguments)}},{key:"deserialize",value:function(e){return new a.default(this._editor,e).deserialize()}}]),e}();t.default=s,s.version="3.0.0"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(5),r=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i.Configurable),t}();t.default=r,r.prototype.availableOptions={identifier:{type:i.OptionType.STRING,required:!0},defaultName:{type:i.OptionType.STRING,required:!0},ratio:{type:i.OptionType.ALL,required:!1,default:null},selected:{type:i.OptionType.BOOLEAN,required:!1},dimensions:{type:i.OptionType.VECTOR2,required:!1},lockDimensions:{type:i.OptionType.BOOLEAN,required:!1,default:null},forceDimensions:{type:i.OptionType.BOOLEAN,required:!1,default:null}}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=i(n(56)),a=i(n(57)),s=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._editor=t}return r(e,[{key:"serialize",value:function(){var e=new o.default(this._editor);return e.serialize.apply(e,arguments)}},{key:"deserialize",value:function(e){return new a.default(this._editor,e).deserialize()}}]),e}();t.default=s,s.version="3.1.0"},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=i(n(58)),a=i(n(59)),s=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._editor=t}return r(e,[{key:"serialize",value:function(){var e=new o.default(this._editor);return e.serialize.apply(e,arguments)}},{key:"deserialize",value:function(e){return new a.default(this._editor,e).deserialize()}}]),e}();t.default=s,s.version="3.2.0"},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=i(n(60)),a=i(n(61)),s=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._editor=t}return r(e,[{key:"serialize",value:function(){var e=new o.default(this._editor);return e.serialize.apply(e,arguments)}},{key:"deserialize",value:function(e){return new a.default(this._editor,e).deserialize()}}]),e}();t.default=s,s.version="3.4.0"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._ui=t,this._options=n,this._categoriesByIdentifier={},this._categories=[],this._artFiltersByIdentifier={},this._initCategories()}return i(e,[{key:"_initCategories",value:function(){var e=this,t={identifier:"standard",defaultName:"Standard",artFilters:r.SharedConstants.DEFAULTS.ART_FILTERS||[]};if(this._categories=[t],this._options.categories&&(this._options.replaceCategories?this._categories=this._options.categories:this._categories=r.Utils.mergeCategories(this._categories,this._options.categories,"artFilters")),this._options.availableArtFilters){var n=[];this._categories.forEach(function(t){var i=t.artFilters.filter(function(t){return-1!==e._options.availableArtFilters.indexOf(t.identifier)});i.length>0&&n.push({identifier:t.identifier,defaultName:t.defaultName,artFilters:i})}),this._categories=n}var i={identifier:"all",defaultName:"All",artFilters:this._categories.length<=0?[]:this._categories.map(function(e){return e.artFilters}).reduce(function(e,t){return e.concat(t)})};this._categories.unshift(i),this._categoriesByIdentifier.all=i,this._categories.forEach(function(t){e._categoriesByIdentifier[t.identifier]=t}),i.artFilters.forEach(function(t){e._artFiltersByIdentifier[t.identifier]=t})}},{key:"instantiateStyleTransferModelForArtFilterWithIdentifier",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getArtFilterByIdentifier(e);if(!n)return Promise.reject(new Error("Unknown style with identifier `"+e+"`!"));var i=n.rootPath,o=this._ui.getEditor().getSDK(),a=o.getRenderer();t.weightURL=this._ui.getAssetPath(i+"/weights.json");var s=o.getInputTexture().getDimensions(),l=o.getOperationsStack().getByIdentifier("exif-orientation");return l&&(s=l.getNewDimensions(s)),r.SDK.Operations.ArtFilterOperation.StyleTransferModel.createWithOptions(t,s,a)}},{key:"updateLoadedModelWithWeightsForIdentifier",value:function(e,t){var n=this.getArtFilterByIdentifier(t);if(!n)return Promise.reject(new Error("Unknown style with identifier `"+t+"`!"));var i=n.rootPath,r=this._ui.getAssetPath(i+"/weights.json");return e.updateWithWeightsFromURL(r)}},{key:"getArtFiltersForCategory",value:function(e){if(!this._categoriesByIdentifier[e])throw new Error("Unknown art filter category '"+e+"'");return this._categoriesByIdentifier[e].artFilters}},{key:"getArtFilterByIdentifier",value:function(e){return this._artFiltersByIdentifier[e]}},{key:"getCategories",value:function(){return this._categories}},{key:"getArtFilters",value:function(){var e=this,t=[];return this._categories.map(function(n){t.push.apply(t,function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(e.getArtFiltersForCategory(n.identifier)))}),t}},{key:"getCategoryByIdentifier",value:function(e){return this._categoriesByIdentifier[e]}}]),e}();t.default=o},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=i(n(62)),a=i(n(63)),s=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._editor=t}return r(e,[{key:"serialize",value:function(){var e=new o.default(this._editor);return e.serialize.apply(e,arguments)}},{key:"deserialize",value:function(e){return new a.default(this._editor,e).deserialize()}}]),e}();t.default=s,s.version="3.5.0"},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=i(n(64)),a=i(n(65)),s=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._editor=t}return r(e,[{key:"serialize",value:function(){var e=new o.default(this._editor);return e.serialize.apply(e,arguments)}},{key:"deserialize",value:function(e){return new a.default(this._editor,e).deserialize()}}]),e}();t.default=s,s.version="3.6.0"},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=i(n(202)),a=i(n(203)),s=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._editor=t}return r(e,[{key:"serialize",value:function(){var e=new o.default(this._editor);return e.serialize.apply(e,arguments)}},{key:"deserialize",value:function(e){return new a.default(this._editor,e).deserialize()}}]),e}();t.default=s,s.version="3.7.0"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(e){return e&&e.__esModule?e:{default:e}}(n(64)),o=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.default),i(t,[{key:"serialize",value:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"serialize",this).call(this,n).then(function(t){return e._serializeAssetLibrary(t).then(function(e){return e})})}},{key:"_serializeAssetLibrary",value:function(e){if(!this._editor.getDynamicAssetsLibrary)return Promise.resolve(e);var t=this._editor.getDynamicAssetsLibrary(),n=this._serializeCustomStickerAssets(e,t);return 0===n.length?Promise.resolve(e):(e.assetLibrary={assets:{stickers:n}},Promise.resolve(e))}},{key:"_serializeCustomStickerAssets",value:function(e,t){var n=t.getAssets("sticker");if(0===n.length)return[];var i={};return e.operations.filter(function(e){return"sprite"===e.type}).flatMap(function(e){return e.options.sprites}).filter(function(e){return"sticker"===e.type}).map(function(e){return e.options.identifier}).forEach(function(e){i[e]=!0}),n.filter(function(e){return i[e.identifier]}).map(function(e){var t=e.identifier,n=e.defaultName,i=e.images,r=i.mediaBase.uris[0],o=i.mediaBase.isSVG,a=/^data:(image\/(jpeg|png));base64,(.*)$/g.exec(r),s={identifier:t,name:n,raster:{type:a[1],data:a[3]}};return n&&(s.name=n),o&&(s.svg={data:i.mediaBase.uris[1].replace(/^data:image\/svg\+xml;base64,/g,"")}),s})}}]),t}();t.default=o,o.version="3.7.0"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(5),o=function(e){return e&&e.__esModule?e:{default:e}}(n(65)),a=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.default),i(t,[{key:"deserialize",value:function(){var e=this;return this._validateVersion().then(function(){return e._deserializeAssetLibrary()}).then(function(){return e._deserializeInputImage()}).then(function(){return e._deserializeOperations()})}},{key:"_deserializeAssetLibrary",value:function(){var e=this;return new Promise(function(t,n){var i=e._data;if(i.assetLibrary){var r=i.assetLibrary.assets,o=[];for(var a in r)o.push(e._deserializeCustomAssets(a,r[a]));return Promise.all(o).then(function(){t()}).catch(function(e){console.error(e),n(e)})}t()})}},{key:"_deserializeCustomAssets",value:function(e,t){switch(e){case"stickers":return this._deserializeCustomStickerAssets(t);default:return Promise.reject(new Error("Unknown asset type: "+e))}}},{key:"_deserializeCustomStickerAssets",value:function(e){var t=this,n="none",i=this._editor.getOptions().controlsOptions;i&&i.controlsOptions&&i.controlsOptions.sticker&&(n=i.controlsOptions.sticker.customStickerTintMode||"none");var o=e.map(function(e){return new Promise(function(i,o){var a=e.identifier,s=e.raster,l=void 0!==e.svg,c="data:"+s.type+";base64,"+s.data,u=new r.Image;u.onload=function(){var r={data:"",width:1,height:1};r=t._stickerManager.renderStickerThumbnailFromImage(u);var o={identifier:a,defaultName:e.name||"",tintMode:n,images:{mediaBase:{uris:[c],rawData:!0,isSVG:l,width:u.width,height:u.height},mediaThumb:{uris:[r.data],rawData:!0,width:r.width,height:r.height}}};if(l){var s="data:image/svg+xml;base64,"+e.svg.data;o.images.mediaBase.uris.push(s)}i(o)},u.onerror=function(){o(new Error("Invalid base64 data: "+c))},u.src=c})});return Promise.all(o).then(function(e){t._editor.getDynamicAssetsLibrary().setAssets("sticker",e),t._stickerManager.reload()})}}]),t}();t.default=a,a.version="3.7.0"},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(i):void 0},a=n(0),s=i(n(205)),l=i(n(206)),c=i(n(207)),u=i(n(208)),f=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._modalManager=o.props.modalManager,o._bindAll("_onModalManagerUpdate"),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.BaseComponent),r(t,[{key:"componentDidMount",value:function(){o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this),this._modalManager.on("update",this._onModalManagerUpdate)}},{key:"componentWillUnmount",value:function(){o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"componentWillUnmount",this).call(this),this._modalManager.off("update",this._onModalManagerUpdate)}},{key:"_onModalManagerUpdate",value:function(){this.forceUpdate()}},{key:"_onModalClosed",value:function(e){this._modalManager.removeModal(e)}},{key:"_renderModals",value:function(){var e=this;return this._modalManager.getModals().map(function(t){var n=void 0;switch(t.type){case"loading":n=s.default;break;case"warning":n=l.default;break;case"error":n=c.default;break;case"progress":n=u.default}return a.ReactBEM.createElement(n,{modal:t,onClose:e._onModalClosed.bind(e,t)})})}},{key:"renderWithBEM",value:function(){return a.ReactBEM.createElement("div",null,this._renderModals())}}]),t}();t.default=f,f.contextTypes=a.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"renderWithBEM",value:function(){var e=this.props.modal;return r.ReactBEM.createElement("bem",{specifier:"$b:modals"},r.ReactBEM.createElement("div",{bem:"e:overlay"},r.ReactBEM.createElement("div",{bem:"e:modal m:loading"},r.ReactBEM.createElement("div",{bem:"e:text"},e.text))))}}]),t}();t.default=o,o.propTypes={modal:r.PropTypes.object},o.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"renderWithBEM",value:function(){var e=this.props.modal;return r.ReactBEM.createElement("bem",{specifier:"$b:modals"},r.ReactBEM.createElement("div",{bem:"e:modal m:warning"},r.ReactBEM.createElement("div",{bem:"e:title"},e.title),r.ReactBEM.createElement("div",{bem:"e:text"},e.text),r.ReactBEM.createElement("div",{bem:"e:button b:button m:inline",onClick:this.props.onClose},"OK")))}}]),t}();t.default=o,o.propTypes={modal:r.PropTypes.object},o.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i)));return o._bindAll("_onClose"),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"_onClose",value:function(){this.props.modal.close()}},{key:"renderWithBEM",value:function(){var e=this.props.modal,t=r.ReactBEM.createElement("div",{bem:"e:modal m:error"},r.ReactBEM.createElement("div",{bem:"e:title"},e.title),r.ReactBEM.createElement("div",{bem:"e:text"},e.text),r.ReactBEM.createElement("div",{bem:"e:button b:button m:inline",onClick:this._onClose},"OK")),n=e.overlay?r.ReactBEM.createElement("div",{bem:"e:overlay"},t):t;return r.ReactBEM.createElement("bem",{specifier:"$b:modals"},n)}}]),t}();t.default=o,o.propTypes={modal:r.PropTypes.object},o.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.BaseComponent),i(t,[{key:"renderWithBEM",value:function(){var e=this.props.modal,t={width:(100*(e.data.progress||0)).toFixed(2)+"%"};return r.ReactBEM.createElement("bem",{specifier:"$b:modals"},r.ReactBEM.createElement("div",{bem:"e:overlay"},r.ReactBEM.createElement("div",{bem:"e:modal m:loading"},r.ReactBEM.createElement("div",{bem:"e:text"},e.text),r.ReactBEM.createElement("bem",{specifier:"b:loadingModal"},r.ReactBEM.createElement("div",{bem:"$e:progressBar"},r.ReactBEM.createElement("div",{bem:"e:progress",style:t}))))))}}]),t}();t.default=o,o.propTypes={modal:r.PropTypes.object},o.contextTypes=r.BaseComponent.contextTypes},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(41)),a=function(e){function t(e,n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return r._ui=e,r._options=n,r._mediator=i,r._assets={},r._editor=new o.default(e,n,i,!0),r._assets=["controls/back.png","controls/minus.png","controls/plus.png","controls/tick.png","controls/webcam/shutter.png","controls/knobs/remove.png","controls/knobs/resize-diagonal-down.png","controls/knobs/resize-diagonal-up.png","controls/knobs/rotate.png","editor/export.png","editor/new.png","editor/undo.png",["splash/photo-roll.png",!1,!0],["splash/webcam.png",!1,!0],"top-bar/back.png","close.png"],r._appendControlsAssets(),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.EventEmitter),i(t,[{key:"_appendControlsAssets",value:function(){var e=this._editor.controls.getAvailable();for(var t in e){var n=e[t];this._editor.controls.isEnabled(t)&&(this._assets=this._assets.concat(n.getPreloadAssets(this._editor)),this._assets.push(n.iconPath))}}},{key:"load",value:function(){var e=this,t=this._assets.slice(),n=t.length,i=0,o=function(){i++,e.emit("progress",i/n),i===n&&e.emit("done")},a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"timed out";r.Log.warn("Preloader",e+" "+t+"."),o()};t.forEach(function(t){var n=!0,i=!0;r.SDKUtils.isArray(t)&&(i=t[2],n=t[1],t=t[0]);var s=e._ui.getAssetPath(t,i,!n),l=new window.Image,c=function(e){return window.setTimeout(function(){a(e)},5e3)}(s);l.addEventListener("load",function(){e._assets[s]=l,window.clearTimeout(c),o()}),l.addEventListener("error",function(){window.clearTimeout(c),a(s,"was not found")}),l.crossOrigin=r.SDKUtils.getCrossOriginValue(e._options.crossOrigin),l.src=s})}},{key:"getAsset",value:function(e){return this._assets[e]}}]),t}();t.default=a},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(211);Object.defineProperty(t,"Provider",{enumerable:!0,get:function(){return i(r).default}});var o=n(212);Object.defineProperty(t,"Library",{enumerable:!0,get:function(){return i(o).default}});var a=n(213);Object.defineProperty(t,"SearchSuggestion",{enumerable:!0,get:function(){return i(a).default}});var s=n(214);Object.defineProperty(t,"Photo",{enumerable:!0,get:function(){return i(s).default}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(0),o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return i(e,[{key:"getLibraries",value:function(){return r.Log.warn(this.constructor.name,"`getLibraries` is abstract and not implemented."),r.Promise.resolve([])}},{key:"getSearchSuggestions",value:function(){return r.Log.warn(this.constructor.name,"`getSearchSuggestions` is abstract and not implemented."),r.Promise.resolve([])}},{key:"getPhotosForLibrary",value:function(e){return r.Log.warn(this.constructor.name,"`getPhotosForLibrary` is abstract and not implemented."),r.Promise.resolve([])}},{key:"searchPhotos",value:function(e){return r.Log.warn(this.constructor.name,"`searchPhotos` is abstract and not implemented."),r.Promise.resolve([])}}]),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.name=t.name,this.coverImage=t.coverImage}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.query=t.query,this.name=this.query,this.coverImage=t.coverImage}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.library=t,this.title=n.title,this.urls=n.urls}},function(e,t){e.exports={pesdk:{adjustments:{title:{name:"Korrekturen"},text:{brightness:"Helligkeit",saturation:"Sättigung",contrast:"Kontrast",gamma:"Gamma",sharpness:"Schärfe",clarity:"Klarheit",exposure:"Belichtung",shadows:"Schatten",highlights:"Lichter",whites:"Weiß",blacks:"Schwarz",temperature:"Temperatur"}},brush:{title:{name:"Malen"},text:{size:"Dicke"}},camera:{title:{headline:"Mache ein Foto!"},text:{webcamUnavailable:"Webcam-Bild kann nicht dargestellt werden. (Fehler: ${error})"}},common:{title:{error:"Es ist ein Fehler aufgetreten",imageLoadFail:"Bild konnte nicht geladen werden"},text:{color:"Farbe",loading:"Lade...",imageLoadFail:"Beim Laden des Bildes unter ${path} ist ein Fehler aufgetreten."},button:{back:"Zurück",cancel:"Abbrechen"}},editor:{title:{zoom:"Zoom",renderingError:"Rendering-Fehler",imageResized_maxMegaPixels:"Bild verkleinert",imageResized_maxDimensions:"Bild verkleinert"},button:{export:"Speichern",backgroundImage:"Hintergrundbild",new:"Neu",undo:"Rückgängig"},text:{invalidFileType:"Der Dateityp ${fileType} wird nicht unterstützt.",exporting:"Exportiere...",renderingError:"Beim Rendern des Bildes ist ein Fehler aufgetreten.",resizing:"Bild wird bearbeitet...",imageResized_maxMegaPixels:"Da dein Bild die maximale Größe von ${maxMegaPixels} Megapixeln überschreitet, wurde es auf ${width}x${height} Pixel verkleinert.",imageResized_maxDimensions:"Aufgrund von Hardware-Beschränkungen wurde das Bild auf ${width}x${height} Pixel verkleinert."}},filter:{title:{name:"Filter"},text:{intensity:"Intensität"},asset:{identity:"Original",imgly_lut_celsius:"Inferno",imgly_lut_chest:"Chestnut",imgly_lut_fixie:"Fixie",imgly_lut_fridge:"Fridge",imgly_lut_front:"Sunny 70s",imgly_lut_k2:"Flat Black",imgly_lut_mellow:"Mellow",imgly_lut_sin:"Hard Stuff",imgly_lut_texas:"Oldtimer",imgly_lut_ad1920:"1920 A.D.",imgly_lut_ancient:"Ancient",imgly_lut_bleached:"Kalmen",imgly_lut_bleachedblue:"Joran",imgly_lut_blues:"Polaroid",imgly_lut_blueshadows:"Zephyr",imgly_lut_breeze:"Levante",imgly_lut_bw:"Greyed",imgly_lut_classic:"Classic",imgly_lut_colorful:"Colorful",imgly_lut_cool:"Snappy",imgly_lut_cottoncandy:"Candy",imgly_lut_creamy:"Creamy",imgly_lut_eighties:"Low Fire",imgly_lut_elder:"Colla",imgly_lut_evening:"Sunrise",imgly_lut_fall:"Moss",imgly_lut_food:"Food",imgly_lut_glam:"Glam",imgly_lut_gobblin:"Gobblin",imgly_lut_highcarb:"High Carb",imgly_lut_highcontrast:"Hicon",imgly_lut_k1:"K1",imgly_lut_k6:"K6",imgly_lut_kdynamic:"Pebble",imgly_lut_keen:"Keen",imgly_lut_lenin:"Lemon",imgly_lut_litho:"Litho",imgly_lut_lomo:"Lomo",imgly_lut_lomo100:"Lomo 100",imgly_lut_lucid:"Lucid",imgly_lut_neat:"Neat",imgly_lut_nogreen:"Pumpkin",imgly_lut_orchid:"Solanus",imgly_lut_pale:"Pale",imgly_lut_pitched:"Pitched",imgly_lut_plate:"Weathered",imgly_lut_pola669:"Green Gap",imgly_lut_polasx:"Pola SX",imgly_lut_pro400:"Pro 400",imgly_lut_quozi:"Quozi",imgly_lut_sepiahigh:"Sepia",imgly_lut_settled:"Settled",imgly_lut_seventies:"Seventies",imgly_lut_soft:"Soft",imgly_lut_steel:"Steel",imgly_lut_summer:"Summer",imgly_lut_sunset:"Golden",imgly_lut_tender:"Tender",imgly_lut_twilight:"Twilight",imgly_lut_winter:"Softy",imgly_lut_x400:"Dusty",imgly_duotone_desert:"Desert",imgly_duotone_peach:"Peach",imgly_duotone_clash:"Clash",imgly_duotone_plum:"Plum",imgly_duotone_breezy:"Breezy",imgly_duotone_deepblue:"Deep Blue",imgly_duotone_frog:"Frog",imgly_duotone_sunset:"Sunset",imgly_filters_analog:"Analog",imgly_filters_bw:"Black & White",imgly_filters_retro:"Retro",imgly_filters_special:"Special",imgly_filters_summer:"Summer",imgly_filters_winter:"Winter",imgly_filters_legacy:"Legacy",all:"Alle"}},focus:{title:{name:"Focus"},text:{blurRadius:"Radius"},button:{none:"Original",radial:"Kreisförmig",mirrored:"Gespiegelt"}},frame:{title:{name:"Rahmen"},text:{scale:"Größe"},button:{none:"Kein Rahmen"},asset:{imgly_frame_dia:"Dia",imgly_frame_art_decor:"Art Decor",imgly_frame_black_passepartout:"Black",imgly_frame_lowpoly_shadow:"Low Poly",imgly_frame_wood_passepartout:"Wood"}},library:{title:{searchResults:'Suchergebnisse für "${query}"',photoRollLoadFail:"Laden der Photo Roll fehlgeschlagen"},text:{photoRollLoadFail:"Failed to load photos for the photo roll: ${error}",noSearchResults:"Die Photo Roll konnte nicht geladen werden: ${error}"},placeholder:{search:"Nach Fotos suchen"}},splash:{button:{upload:"Lade ein Foto hoch"},title:{photoRoll:"Kostenloses Bildmaterial",webcam:"Webcam"},text:{photoRoll:"Suche dir eines von tausenden Stock Photos aus.",upload:"Klicke hier, um ein Foto von deinem Rechner hochzuladen oder lade es per Drag-and-Drop hoch",webcam:"Klicke hier, um ein Foto mit deiner Webcam zu machen"}},sticker:{title:{name:"Sticker",loadingStickersFailed:"Laden der Sticker fehlgeschlagen"},asset:{all:"Alle",imgly_sticker_emoticons:"Emoticons",imgly_sticker_shapes:"Shapes"}},text:{title:{name:"Text",loadingFontsFailed:"Laden der Schriftarten fehlgeschlagen"},text:{loadingFontsFailed:"Einige Schriftarten sind möglicherweise nicht verfügbar."},button:{size:"Größe",font:"Schriftart",alignment:"Ausrichtung",foreground:"Vordergrund",background:"Hintergrund",takeToFront:"Nach oben"},placeholder:{defaultText:"Doppelklick zum Bearbeiten!"}},transform:{title:{name:"Zuschneiden"},button:{none:"Original"},text:{rotation:"Drehung"},asset:{imgly_transform_common_custom:"Frei",imgly_transform_common_square:"Quadratisch","imgly_transform_common_4-3":"4:3","imgly_transform_common_16-9":"16:9",imgly_transform_facebook_ad:"FB Ad",imgly_transform_facebook_post:"FB Post",imgly_transform_facebook_cover:"FB Cover",imgly_transform_facebook_profile:"FB Profile"}}}}},function(e,t){e.exports={pesdk:{adjustments:{title:{name:"Adjust"},text:{brightness:"Brightness",saturation:"Saturation",contrast:"Contrast",gamma:"Gamma",sharpness:"Sharpness",clarity:"Clarity",exposure:"Exposure",shadows:"Shadows",highlights:"Highlights",whites:"Whites",blacks:"Blacks",temperature:"Temperature"}},brush:{title:{name:"Brush"},text:{size:"Size"}},camera:{title:{headline:"Take a photo!"},text:{webcamUnavailable:"Unable to display webcam image (Error: ${error})"}},common:{title:{error:"An error has occurred",imageLoadFail:"Failed to load image"},text:{color:"Color",loading:"Loading...",imageLoadFail:"Failed to load the image at ${path}"},button:{back:"Back",cancel:"Cancel"}},editor:{title:{zoom:"Zoom",renderingError:"Error while rendering",imageResized_maxMegaPixels:"Image resized",imageResized_maxDimensions:"Image resized"},button:{export:"Export",backgroundImage:"Background Image",new:"New",undo:"Undo"},text:{invalidFileType:"The file type ${fileType} is not supported.",exporting:"Exporting...",renderingError:"An error has occurred while rendering the image.",resizing:"Resizing...",imageResized_maxMegaPixels:"Your image exceeds the maximum size of ${maxMegaPixels} megapixels and has therefore been resized to ${width}x${height} pixels.",imageResized_maxDimensions:"Due to hardware limitations your image has been resized to ${width}x${height} pixels."}},filter:{title:{name:"Filters"},text:{intensity:"Intensity"},asset:{identity:"None",imgly_lut_celsius:"Inferno",imgly_lut_chest:"Chestnut",imgly_lut_fixie:"Fixie",imgly_lut_fridge:"Fridge",imgly_lut_front:"Sunny 70s",imgly_lut_k2:"Flat Black",imgly_lut_mellow:"Mellow",imgly_lut_sin:"Hard Stuff",imgly_lut_texas:"Oldtimer",imgly_lut_ad1920:"1920 A.D.",imgly_lut_ancient:"Ancient",imgly_lut_bleached:"Kalmen",imgly_lut_bleachedblue:"Joran",imgly_lut_blues:"Polaroid",imgly_lut_blueshadows:"Zephyr",imgly_lut_breeze:"Levante",imgly_lut_bw:"Greyed",imgly_lut_classic:"Classic",imgly_lut_colorful:"Colorful",imgly_lut_cool:"Snappy",imgly_lut_cottoncandy:"Candy",imgly_lut_creamy:"Creamy",imgly_lut_eighties:"Low Fire",imgly_lut_elder:"Colla",imgly_lut_evening:"Sunrise",imgly_lut_fall:"Moss",imgly_lut_food:"Food",imgly_lut_glam:"Glam",imgly_lut_gobblin:"Gobblin",imgly_lut_highcarb:"High Carb",imgly_lut_highcontrast:"Hicon",imgly_lut_k1:"K1",imgly_lut_k6:"K6",imgly_lut_kdynamic:"Pebble",imgly_lut_keen:"Keen",imgly_lut_lenin:"Lemon",imgly_lut_litho:"Litho",imgly_lut_lomo:"Lomo",imgly_lut_lomo100:"Lomo 100",imgly_lut_lucid:"Lucid",imgly_lut_neat:"Neat",imgly_lut_nogreen:"Pumpkin",imgly_lut_orchid:"Solanus",imgly_lut_pale:"Pale",imgly_lut_pitched:"Pitched",imgly_lut_plate:"Weathered",imgly_lut_pola669:"Green Gap",imgly_lut_polasx:"Pola SX",imgly_lut_pro400:"Pro 400",imgly_lut_quozi:"Quozi",imgly_lut_sepiahigh:"Sepia",imgly_lut_settled:"Settled",imgly_lut_seventies:"Seventies",imgly_lut_soft:"Soft",imgly_lut_steel:"Steel",imgly_lut_summer:"Summer",imgly_lut_sunset:"Golden",imgly_lut_tender:"Tender",imgly_lut_twilight:"Twilight",imgly_lut_winter:"Softy",imgly_lut_x400:"Dusty",imgly_duotone_desert:"Desert",imgly_duotone_peach:"Peach",imgly_duotone_clash:"Clash",imgly_duotone_plum:"Plum",imgly_duotone_breezy:"Breezy",imgly_duotone_deepblue:"Deep Blue",imgly_duotone_frog:"Frog",imgly_duotone_sunset:"Sunset",imgly_filters_analog:"Analog",imgly_filters_bw:"Black & White",imgly_filters_retro:"Retro",imgly_filters_special:"Special",imgly_filters_summer:"Summer",imgly_filters_winter:"Winter",imgly_filters_legacy:"Legacy",all:"All"}},focus:{title:{name:"Focus"},text:{blurRadius:"Blur radius"},button:{none:"None",radial:"Radial",mirrored:"Mirrored"}},frame:{title:{name:"Frame"},text:{scale:"Scale"},button:{none:"None"},asset:{imgly_frame_dia:"Dia",imgly_frame_art_decor:"Art Decor",imgly_frame_black_passepartout:"Black",imgly_frame_lowpoly_shadow:"Low Poly",imgly_frame_wood_passepartout:"Wood"}},library:{title:{searchResults:'Search results for "${query}"',photoRollLoadFail:"Failed to load Photo Roll"},text:{photoRollLoadFail:"Failed to load photos for the photo roll: ${error}",noSearchResults:'Sorry, but we couldn\'t find any photos for <strong>"${query}"</strong>.'},placeholder:{search:"Search for photos"}},splash:{button:{upload:"Upload your image"},title:{photoRoll:"Free stock footage",webcam:"Webcam"},text:{photoRoll:"Select from thousands of Free Stock Photos",upload:"Upload a picture from your library or just drag and drop",webcam:"Take a picture with your webcam or phone"}},sticker:{title:{name:"Sticker",loadingStickersFailed:"Failed to load stickers"},asset:{all:"All",imgly_sticker_emoticons:"Emoticons",imgly_sticker_shapes:"Shapes"}},text:{title:{name:"Text",loadingFontsFailed:"Failed to load fonts"},text:{loadingFontsFailed:"Some fonts might not be available."},button:{size:"Size",font:"Font",alignment:"Alignment",foreground:"Foreground",background:"Background",takeToFront:"To Front"},placeholder:{defaultText:"Double-click to edit"}},transform:{title:{name:"Transform"},button:{none:"Original"},text:{rotation:"Rotation"},asset:{imgly_transform_common_custom:"Custom",imgly_transform_common_square:"Square","imgly_transform_common_4-3":"4:3","imgly_transform_common_16-9":"16:9",imgly_transform_facebook_ad:"FB Ad",imgly_transform_facebook_post:"FB Post",imgly_transform_facebook_cover:"FB Cover",imgly_transform_facebook_profile:"FB Profile"}}}}}])});